package org.ethereum.net.message;

import org.ethereum.core.Genesis;
import org.ethereum.crypto.HashUtil;
import org.spongycastle.util.encoders.Hex;

/**
 * www.ethereumJ.com
 * @author: Roman Mandeleil
 * Created on: 13/04/14 20:19
 */
public class StaticMessages {

    public static final byte[] PING             = Hex.decode("2240089100000002C102");
    public static final byte[] PONG             = Hex.decode("2240089100000002C103");
    public static final byte[] GET_PEERS        = Hex.decode("2240089100000002C110");
    public static final byte[] GET_TRANSACTIONS = Hex.decode("2240089100000002C116");

    public static final byte[] DISCONNECT_08 = Hex.decode("2240089100000003C20108");
    public static final byte[] GENESIS_HASH = Genesis.getInstance().getHash();

    public static final byte[] MAGIC_PACKET = Hex.decode("22400891");

    static {
        HELLO_MESSAGE = generateHelloMessage();
    }
    public static HelloMessage HELLO_MESSAGE;
    public static HelloMessage generateHelloMessage() {
        byte[] peerIdBytes = HashUtil.randomPeerId();

        return new HelloMessage((byte) 0x14, (byte) 0x00,
                "EthereumJ [v0.5.1]  by RomanJ", (byte) 0b00000111,
                (short) 30303, peerIdBytes);
    }
}

@@ -1177,25 +1177,32 @@
 J%22, 
-(byte) 0b
+Byte.parseByte(%22
 00000111
 ,%0A  
@@ -1197,16 +1197,21 @@
 00000111
+%22, 2)
 ,%0A      

Use byte parsing instead of binary literal