Bitcoin Forum
May 09, 2024, 04:38:16 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: "getheaders", how do they work?  (Read 1690 times)
dirtyfilthy (OP)
Member
**
Offline Offline

Activity: 77
Merit: 10


View Profile
February 03, 2011, 12:53:18 PM
 #1

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?
You get merit points when someone likes your post enough to give you some. And for every 2 merit points you receive, you can send 1 merit point to someone else!
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715272696
Hero Member
*
Offline Offline

Posts: 1715272696

View Profile Personal Message (Offline)

Ignore
1715272696
Reply with quote  #2

1715272696
Report to moderator
dirtyfilthy (OP)
Member
**
Offline Offline

Activity: 77
Merit: 10


View Profile
February 04, 2011, 10:35:30 PM
 #2

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.
romanticon
Full Member
***
Offline Offline

Activity: 123
Merit: 100


View Profile
November 15, 2011, 11:02:42 AM
 #3

Can you elaborate a bit , just bumped into the same problem.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!