@Test public void testHeaders1() throws Exception { BitcoinSerializer bs = new BitcoinSerializer(MainNetParams.get()); HeadersMessage hm = (HeadersMessage) bs.deserialize(ByteBuffer.wrap(Hex.decode("f9beb4d9686561" + "646572730000000000520000005d4fab8101010000006fe28c0ab6f1b372c1a6a246ae6" + "3f74f931e8365e15a089c68d6190000000000982051fd1e4ba744bbbe680e1fee14677b" + "a1a3c3540bf7b1cdb606e857233e0e61bc6649ffff001d01e3629900"))); Block block = hm.getBlockHeaders().get(0); String hash = block.getHashAsString(); assertEquals(hash, "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048"); assertNull(block.transactions); assertEquals(Utils.bytesToHexString(block.getMerkleRoot().getBytes()), "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098"); }
public Message deserialize(ByteBuffer in) throws ProtocolException, IOException { seekPastMagicBytes(in); BitcoinPacketHeader header = new BitcoinPacketHeader(in); return deserializePayload(header, in); }
BitcoinSerializer { public Message deserialize(ByteBuffer in) throws ProtocolException, IOException { seekPastMagicBytes(in); BitcoinPacketHeader header = new BitcoinPacketHeader(in); return deserializePayload(header, in); } }
BitcoinSerializer { public Message deserialize(ByteBuffer in) throws ProtocolException, IOException { seekPastMagicBytes(in); BitcoinPacketHeader header = new BitcoinPacketHeader(in); return deserializePayload(header, in); } BitcoinSerializer(NetworkParameters params);  BitcoinSerializer(NetworkParameters params, boolean parseLazy, boolean parseRetain); }
BitcoinSerializer { public Message deserialize(ByteBuffer in) throws ProtocolException, IOException { seekPastMagicBytes(in); BitcoinPacketHeader header = new BitcoinPacketHeader(in); return deserializePayload(header, in); } BitcoinSerializer(NetworkParameters params);  BitcoinSerializer(NetworkParameters params, boolean parseLazy, boolean parseRetain); void serialize(String name, byte[] message, OutputStream out); void serialize(Message message, OutputStream out); Message deserialize(ByteBuffer in); BitcoinPacketHeader deserializeHeader(ByteBuffer in); Message deserializePayload(BitcoinPacketHeader header, ByteBuffer in); void seekPastMagicBytes(ByteBuffer in); boolean isParseLazyMode(); boolean isParseRetainMode(); }
BitcoinSerializer { public Message deserialize(ByteBuffer in) throws ProtocolException, IOException { seekPastMagicBytes(in); BitcoinPacketHeader header = new BitcoinPacketHeader(in); return deserializePayload(header, in); } BitcoinSerializer(NetworkParameters params);  BitcoinSerializer(NetworkParameters params, boolean parseLazy, boolean parseRetain); void serialize(String name, byte[] message, OutputStream out); void serialize(Message message, OutputStream out); Message deserialize(ByteBuffer in); BitcoinPacketHeader deserializeHeader(ByteBuffer in); Message deserializePayload(BitcoinPacketHeader header, ByteBuffer in); void seekPastMagicBytes(ByteBuffer in); boolean isParseLazyMode(); boolean isParseRetainMode();  }