Bitcoin Forum
December 04, 2016, 10:44:31 PM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Node not responding to getdata message  (Read 1056 times)
TT
Member
**
Offline Offline

Activity: 77



View Profile
November 13, 2011, 05:12:06 AM
 #1

I'm working on the network i/o for a bitcoin node. Immediately after receiving an inv message from a peer,
I'm sending it back but just changing the "inv" command to "getdata". It is my understanding that the inventory
list structure is identical in both types of message, and therefore the payload can be identical. Only the 12 byte
command code needs to be changed from {'i','n','v',0,0,0,0,0,0,0,0,0} to {'g','e','t','d','a','t','a',0,0,0,0,0}. Other
nodes seem to recognize the message as a getdata message, but are not replying with any tx or block messages.

Any ideas why?
There are several different types of Bitcoin clients. The most secure are full nodes like Bitcoin-Qt, which will follow the rules of the network no matter what miners do. Even if every miner decided to create 1000 bitcoins per block, full nodes would stick to the rules and reject those blocks.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
theymos
Administrator
Legendary
*
expert
Offline Offline

Activity: 2492


View Profile
November 13, 2011, 05:22:52 AM
 #2

Are you updating the checksum?

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
TT
Member
**
Offline Offline

Activity: 77



View Profile
November 13, 2011, 05:27:00 AM
 #3

If the payload is the same, wouldn't the checksum also remain the same?
theymos
Administrator
Legendary
*
expert
Offline Offline

Activity: 2492


View Profile
November 13, 2011, 06:16:22 AM
 #4

Ah, you're right about that.

Post a hexdump of what you're sending.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
TT
Member
**
Offline Offline

Activity: 77



View Profile
November 13, 2011, 06:55:32 AM
 #5

OK, I received the following data:
----
Received data: 0xf9 0xbe 0xb4 0xd9 0x69 0x6e 0x76 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x25 0x00 0x00 0x00 0x8f 0xa1 0x8b 0x5e 0x01 0x01 0x00 0x00 0x00 0x79 0xb8 0x25 0x10 0x3d 0xca 0x85 0xf8 0x90 0xc2 0x24 0x79 0x22 0x1c 0x27 0xab 0x4f 0x73 0x60 0x49 0x94 0x54 0x3a 0xe8 0x3e 0x4a 0x4e 0x10 0x43 0x51 0x2b 0x8c
----
Formatted in human-readable form, it's:

Command: inv
Payload size(bytes): 37
Inventory count: 1
  Item 1:
    Type: MSG_TX
    Hash: 8c2b5143104e4a3ee83a54944960734fab271c227924c290f885ca3d1025b879

I'm sending back:
----
Sending getdata: 0xf9 0xbe 0xb4 0xd9 0x67 0x65 0x74 0x64 0x61 0x74 0x61 0x00 0x00 0x00 0x00 0x00 0x25 0x00 0x00 0x00 0x8f 0xa1 0x8b 0x5e 0x01 0x01 0x00 0x00 0x00 0x79 0xb8 0x25 0x10 0x3d 0xca 0x85 0xf8 0x90 0xc2 0x24 0x79 0x22 0x1c 0x27 0xab 0x4f 0x73 0x60 0x49 0x94 0x54 0x3a 0xe8 0x3e 0x4a 0x4e 0x10 0x43 0x51 0x2b 0x8c
----
TT
Member
**
Offline Offline

Activity: 77



View Profile
November 13, 2011, 01:22:03 PM
 #6

I just dropped the four checksum bytes and it worked!

I think this detail was omitted in https://en.bitcoin.it/wiki/Protocol_specification

It says
Quote
The version and verack messages do not have a checksum, the payload starts 4 bytes earlier.

Apparently, this is also the case for getdata messages. Someone might want to update the wiki.

-TT
theymos
Administrator
Legendary
*
expert
Offline Offline

Activity: 2492


View Profile
November 14, 2011, 10:29:12 AM
 #7

Hmm... I'm pretty sure my network code puts a checksum on those messages.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
kokjo
Legendary
*
Offline Offline

Activity: 1050

You are WRONG!


View Profile
November 14, 2011, 10:38:23 AM
 #8

Hmm... I'm pretty sure my network code puts a checksum on those messages.
mine too and they are working. putting checksums on anything, but version and verack

"The whole problem with the world is that fools and fanatics are always so certain of themselves and wiser people so full of doubts." -Bertrand Russell
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!