test_class.declarator: addrMessage = Hex.decode("f9beb4d96164647200000000000000001f000000" +
              "ed52399b01e215104d010000000000000000000000000000000000ffff0a000001208d")
test_class.modifier: private final
test_class.original_string: private final byte[] addrMessage = Hex.decode("f9beb4d96164647200000000000000001f000000" +
              "ed52399b01e215104d010000000000000000000000000000000000ffff0a000001208d");
test_class.type: byte[]
test_class.var_name: addrMessage
test_class.declarator: txMessage = Hex.decode(
              "F9 BE B4 D9 74 78 00 00  00 00 00 00 00 00 00 00" +
              "02 01 00 00 E2 93 CD BE  01 00 00 00 01 6D BD DB" +
              "08 5B 1D 8A F7 51 84 F0  BC 01 FA D5 8D 12 66 E9" +
              "B6 3B 50 88 19 90 E4 B4  0D 6A EE 36 29 00 00 00" +
              "00 8B 48 30 45 02 21 00  F3 58 1E 19 72 AE 8A C7" +
              "C7 36 7A 7A 25 3B C1 13  52 23 AD B9 A4 68 BB 3A" +
              "59 23 3F 45 BC 57 83 80  02 20 59 AF 01 CA 17 D0" +
              "0E 41 83 7A 1D 58 E9 7A  A3 1B AE 58 4E DE C2 8D" +
              "35 BD 96 92 36 90 91 3B  AE 9A 01 41 04 9C 02 BF" +
              "C9 7E F2 36 CE 6D 8F E5  D9 40 13 C7 21 E9 15 98" +
              "2A CD 2B 12 B6 5D 9B 7D  59 E2 0A 84 20 05 F8 FC" +
              "4E 02 53 2E 87 3D 37 B9  6F 09 D6 D4 51 1A DA 8F" +
              "14 04 2F 46 61 4A 4C 70  C0 F1 4B EF F5 FF FF FF" +
              "FF 02 40 4B 4C 00 00 00  00 00 19 76 A9 14 1A A0" +
              "CD 1C BE A6 E7 45 8A 7A  BA D5 12 A9 D9 EA 1A FB" +
              "22 5E 88 AC 80 FA E9 C7  00 00 00 00 19 76 A9 14" +
              "0E AB 5B EA 43 6A 04 84  CF AB 12 48 5E FD A0 B7" +
              "8B 4E CC 52 88 AC 00 00  00 00")
test_class.modifier: private final
test_class.original_string: private final byte[] txMessage = Hex.decode(
              "F9 BE B4 D9 74 78 00 00  00 00 00 00 00 00 00 00" +
              "02 01 00 00 E2 93 CD BE  01 00 00 00 01 6D BD DB" +
              "08 5B 1D 8A F7 51 84 F0  BC 01 FA D5 8D 12 66 E9" +
              "B6 3B 50 88 19 90 E4 B4  0D 6A EE 36 29 00 00 00" +
              "00 8B 48 30 45 02 21 00  F3 58 1E 19 72 AE 8A C7" +
              "C7 36 7A 7A 25 3B C1 13  52 23 AD B9 A4 68 BB 3A" +
              "59 23 3F 45 BC 57 83 80  02 20 59 AF 01 CA 17 D0" +
              "0E 41 83 7A 1D 58 E9 7A  A3 1B AE 58 4E DE C2 8D" +
              "35 BD 96 92 36 90 91 3B  AE 9A 01 41 04 9C 02 BF" +
              "C9 7E F2 36 CE 6D 8F E5  D9 40 13 C7 21 E9 15 98" +
              "2A CD 2B 12 B6 5D 9B 7D  59 E2 0A 84 20 05 F8 FC" +
              "4E 02 53 2E 87 3D 37 B9  6F 09 D6 D4 51 1A DA 8F" +
              "14 04 2F 46 61 4A 4C 70  C0 F1 4B EF F5 FF FF FF" +
              "FF 02 40 4B 4C 00 00 00  00 00 19 76 A9 14 1A A0" +
              "CD 1C BE A6 E7 45 8A 7A  BA D5 12 A9 D9 EA 1A FB" +
              "22 5E 88 AC 80 FA E9 C7  00 00 00 00 19 76 A9 14" +
              "0E AB 5B EA 43 6A 04 84  CF AB 12 48 5E FD A0 B7" +
              "8B 4E CC 52 88 AC 00 00  00 00");
test_class.type: byte[]
test_class.var_name: txMessage
test_class.file: core/src/test/java/com/google/bitcoin/core/BitcoinSerializerTest.java
test_class.identifier: BitcoinSerializerTest
test_case.body: @Test
      /**
       * Get 6 headers of blocks 1-6 in the chain
       */
      public void testHeaders2() throws Exception {
          BitcoinSerializer bs = new BitcoinSerializer(MainNetParams.get());
  
          HeadersMessage hm = (HeadersMessage) bs.deserialize(ByteBuffer.wrap(Hex.decode("f9beb4d96865616465" +
                  "72730000000000e701000085acd4ea06010000006fe28c0ab6f1b372c1a6a246ae63f74f931e" +
                  "8365e15a089c68d6190000000000982051fd1e4ba744bbbe680e1fee14677ba1a3c3540bf7b1c" +
                  "db606e857233e0e61bc6649ffff001d01e3629900010000004860eb18bf1b1620e37e9490fc8a" +
                  "427514416fd75159ab86688e9a8300000000d5fdcc541e25de1c7a5addedf24858b8bb665c9f36" +
                  "ef744ee42c316022c90f9bb0bc6649ffff001d08d2bd610001000000bddd99ccfda39da1b108ce1" +
                  "a5d70038d0a967bacb68b6b63065f626a0000000044f672226090d85db9a9f2fbfe5f0f9609b387" +
                  "af7be5b7fbb7a1767c831c9e995dbe6649ffff001d05e0ed6d00010000004944469562ae1c2c74" +
                  "d9a535e00b6f3e40ffbad4f2fda3895501b582000000007a06ea98cd40ba2e3288262b28638cec" +
                  "5337c1456aaf5eedc8e9e5a20f062bdf8cc16649ffff001d2bfee0a9000100000085144a84488e" +
                  "a88d221c8bd6c059da090e88f8a2c99690ee55dbba4e00000000e11c48fecdd9e72510ca84f023" +
                  "370c9a38bf91ac5cae88019bee94d24528526344c36649ffff001d1d03e4770001000000fc33f5" +
                  "96f822a0a1951ffdbf2a897b095636ad871707bf5d3162729b00000000379dfb96a5ea8c81700ea4" +
                  "ac6b97ae9a9312b2d4301a29580e924ee6761a2520adc46649ffff001d189c4c9700")));
  
          int nBlocks = hm.getBlockHeaders().size();
          assertEquals(nBlocks, 6);
  
          // index 0 block is the number 1 block in the block chain
          // http://blockexplorer.com/b/1
          Block zeroBlock = hm.getBlockHeaders().get(0);
          String zeroBlockHash = zeroBlock.getHashAsString();
  
          assertEquals("00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048",
                  zeroBlockHash);
          assertEquals(zeroBlock.getNonce(), 2573394689L);
  
  
          Block thirdBlock = hm.getBlockHeaders().get(3);
          String thirdBlockHash = thirdBlock.getHashAsString();
  
          // index 3 block is the number 4 block in the block chain
          // http://blockexplorer.com/b/4
          assertEquals("000000004ebadb55ee9096c9a2f8880e09da59c0d68b1c228da88e48844a1485",
                  thirdBlockHash);
          assertEquals(thirdBlock.getNonce(), 2850094635L);
      }
test_case.class_method_signature: BitcoinSerializerTest.testHeaders2()
test_case.full_signature: @Test /** * Get 6 headers of blocks 1-6 in the chain */ public void testHeaders2()
test_case.identifier: testHeaders2
test_case.invocations: get deserialize wrap decode size getBlockHeaders assertEquals get getBlockHeaders getHashAsString assertEquals assertEquals getNonce get getBlockHeaders getHashAsString assertEquals assertEquals getNonce
test_case.modifiers: @Test /** * Get 6 headers of blocks 1-6 in the chain */ public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testHeaders2()
focal_class.declarator: log = LoggerFactory.getLogger(BitcoinSerializer.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(BitcoinSerializer.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: COMMAND_LEN = 12
focal_class.modifier: private static final
focal_class.original_string: private static final int COMMAND_LEN = 12;
focal_class.type: int
focal_class.var_name: COMMAND_LEN
focal_class.declarator: params
focal_class.modifier: private
focal_class.original_string: private NetworkParameters params;
focal_class.type: NetworkParameters
focal_class.var_name: params
focal_class.declarator: parseLazy = false
focal_class.modifier: private
focal_class.original_string: private boolean parseLazy = false;
focal_class.type: boolean
focal_class.var_name: parseLazy
focal_class.declarator: parseRetain = false
focal_class.modifier: private
focal_class.original_string: private boolean parseRetain = false;
focal_class.type: boolean
focal_class.var_name: parseRetain
focal_class.declarator: names = new HashMap<Class<? extends Message>, String>()
focal_class.modifier: private static
focal_class.original_string: private static Map<Class<? extends Message>, String> names = new HashMap<Class<? extends Message>, String>();
focal_class.type: Map<Class<? extends Message>, String>
focal_class.var_name: names
focal_class.file: core/src/main/java/com/google/bitcoin/core/BitcoinSerializer.java
focal_class.identifier: BitcoinSerializer
focal_class.class_method_signature: BitcoinSerializer.BitcoinSerializer(NetworkParameters params)
focal_class.full_signature: public  BitcoinSerializer(NetworkParameters params)
focal_class.identifier: BitcoinSerializer
focal_class.modifiers: public
focal_class.parameters: (NetworkParameters params)
focal_class.signature:  BitcoinSerializer(NetworkParameters params)
focal_class.class_method_signature: BitcoinSerializer.BitcoinSerializer(NetworkParameters params, boolean parseLazy, boolean parseRetain)
focal_class.full_signature: public  BitcoinSerializer(NetworkParameters params, boolean parseLazy, boolean parseRetain)
focal_class.identifier: BitcoinSerializer
focal_class.modifiers: public
focal_class.parameters: (NetworkParameters params, boolean parseLazy, boolean parseRetain)
focal_class.signature:  BitcoinSerializer(NetworkParameters params, boolean parseLazy, boolean parseRetain)
focal_class.class_method_signature: BitcoinSerializer.serialize(String name, byte[] message, OutputStream out)
focal_class.full_signature: public void serialize(String name, byte[] message, OutputStream out)
focal_class.identifier: serialize
focal_class.modifiers: public
focal_class.parameters: (String name, byte[] message, OutputStream out)
focal_class.return: void
focal_class.signature: void serialize(String name, byte[] message, OutputStream out)
focal_class.class_method_signature: BitcoinSerializer.serialize(Message message, OutputStream out)
focal_class.full_signature: public void serialize(Message message, OutputStream out)
focal_class.identifier: serialize
focal_class.modifiers: public
focal_class.parameters: (Message message, OutputStream out)
focal_class.return: void
focal_class.signature: void serialize(Message message, OutputStream out)
focal_class.class_method_signature: BitcoinSerializer.deserialize(ByteBuffer in)
focal_class.full_signature: public Message deserialize(ByteBuffer in)
focal_class.identifier: deserialize
focal_class.modifiers: public
focal_class.parameters: (ByteBuffer in)
focal_class.return: Message
focal_class.signature: Message deserialize(ByteBuffer in)
focal_class.class_method_signature: BitcoinSerializer.deserializeHeader(ByteBuffer in)
focal_class.full_signature: public BitcoinPacketHeader deserializeHeader(ByteBuffer in)
focal_class.identifier: deserializeHeader
focal_class.modifiers: public
focal_class.parameters: (ByteBuffer in)
focal_class.return: BitcoinPacketHeader
focal_class.signature: BitcoinPacketHeader deserializeHeader(ByteBuffer in)
focal_class.class_method_signature: BitcoinSerializer.deserializePayload(BitcoinPacketHeader header, ByteBuffer in)
focal_class.full_signature: public Message deserializePayload(BitcoinPacketHeader header, ByteBuffer in)
focal_class.identifier: deserializePayload
focal_class.modifiers: public
focal_class.parameters: (BitcoinPacketHeader header, ByteBuffer in)
focal_class.return: Message
focal_class.signature: Message deserializePayload(BitcoinPacketHeader header, ByteBuffer in)
focal_class.class_method_signature: BitcoinSerializer.makeMessage(String command, int length, byte[] payloadBytes, byte[] hash, byte[] checksum)
focal_class.full_signature: private Message makeMessage(String command, int length, byte[] payloadBytes, byte[] hash, byte[] checksum)
focal_class.identifier: makeMessage
focal_class.modifiers: private
focal_class.parameters: (String command, int length, byte[] payloadBytes, byte[] hash, byte[] checksum)
focal_class.return: Message
focal_class.signature: Message makeMessage(String command, int length, byte[] payloadBytes, byte[] hash, byte[] checksum)
focal_class.class_method_signature: BitcoinSerializer.seekPastMagicBytes(ByteBuffer in)
focal_class.full_signature: public void seekPastMagicBytes(ByteBuffer in)
focal_class.identifier: seekPastMagicBytes
focal_class.modifiers: public
focal_class.parameters: (ByteBuffer in)
focal_class.return: void
focal_class.signature: void seekPastMagicBytes(ByteBuffer in)
focal_class.class_method_signature: BitcoinSerializer.isParseLazyMode()
focal_class.full_signature: public boolean isParseLazyMode()
focal_class.identifier: isParseLazyMode
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isParseLazyMode()
focal_class.class_method_signature: BitcoinSerializer.isParseRetainMode()
focal_class.full_signature: public boolean isParseRetainMode()
focal_class.identifier: isParseRetainMode
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isParseRetainMode()
focal_method.body: public Message deserialize(ByteBuffer in) throws ProtocolException, IOException {
          // A Bitcoin protocol message has the following format.
          //
          //   - 4 byte magic number: 0xfabfb5da for the testnet or
          //                          0xf9beb4d9 for production
          //   - 12 byte command in ASCII
          //   - 4 byte payload size
          //   - 4 byte checksum
          //   - Payload data
          //
          // The checksum is the first 4 bytes of a SHA256 hash of the message payload. It isn't
          // present for all messages, notably, the first one on a connection.
          //
          // Satoshi's implementation ignores garbage before the magic header bytes. We have to do the same because
          // sometimes it sends us stuff that isn't part of any message.
          seekPastMagicBytes(in);
          BitcoinPacketHeader header = new BitcoinPacketHeader(in);
          // Now try to read the whole message.
          return deserializePayload(header, in);
      }
focal_method.class_method_signature: BitcoinSerializer.deserialize(ByteBuffer in)
focal_method.full_signature: public Message deserialize(ByteBuffer in)
focal_method.identifier: deserialize
focal_method.invocations: seekPastMagicBytes deserializePayload
focal_method.modifiers: public
focal_method.parameters: (ByteBuffer in)
focal_method.return: Message
focal_method.signature: Message deserialize(ByteBuffer in)