Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: dirtyfilthy on February 03, 2011, 12:53:18 PM



Title: "getheaders", how do they work?
Post by: dirtyfilthy on February 03, 2011, 12:53:18 PM
In the course of writing a thin client I'm trying to use the getheaders command to download the initial blockheaders rather than the entire blockchain. As far as I can tell I'm sending the correct packet but no one ever responds with "headers".

The raw packet is:

f9beb4d967657468656164657273000041000000c21430dc016fe28c0ab6f1b372c1a6a246ae63f 74f931e8365e15a089c68d619000000000000000000000000000000000000000000000000000000 00000000000000000000

This should be (from reading the source code)

Code:
f9beb4d9... to ...c21430dc raw packet headers
01 varint representing the number of start hashes in the block locator (1)
6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 32 byte hash of genesis block
0000000000000000000000000000000000000000000000000000000000000000 32 byte null stop hash

In theory this should starting pushing "headers" packets in my direction containing block headers starting after the genesis block.

Am I doing anything obviously wrong?


Title: Re: "getheaders", how do they work?
Post by: dirtyfilthy on February 04, 2011, 10:35:30 PM
Eventually solved my own problem here, the protocol specification on the wiki was incorrect, the version number in getheaders ( & getblocks) is always included,*unless* SER_GETHASH is set, not if.


Title: Re: "getheaders", how do they work?
Post by: romanticon on November 15, 2011, 11:02:42 AM
Can you elaborate a bit , just bumped into the same problem.