[bitcoin-dev] Initial getheaders request

Daniel Kraft d at domob.eu
Tue Oct 13 11:02:32 UTC 2015


Hi!

I've stumbled upon the code that does the initial "getheaders" request,
i. e., around line 4960 of src/main.cpp [1].

  [1] https://github.com/bitcoin/bitcoin/blob/master/src/main.cpp#L4960

For some reason, it uses not pindexBestHeader but the *preceding* block
pindexBestHeader->pprev as the "from argument".  In contrast, the
request on line 4132 [2] (which is done in response to a newly announced
block) *does* use pindexBestHeader.

  [2] https://github.com/bitcoin/bitcoin/blob/master/src/main.cpp#L4132

I see no apparent reason for using the preceding call; but if I change
it to pindexBestHeader on line 4960 as well, the wallet.py test seems to
get stuck.  I've not been able to figure out from the logs and the code
why this is the case; can anyone help me?  I think this is something
that should really be explained in a comment around line 4960.  If
someone can make me understand, I can write a pull request for that -- I
guess this will save others some time wondering like I do at the moment.

Yours,
Daniel

-- 
http://www.domob.eu/
OpenPGP: 1142 850E 6DFF 65BA 63D6  88A8 B249 2AC4 A733 0737
Namecoin: id/domob -> https://nameid.org/?name=domob
--
Done:  Arc-Bar-Cav-Hea-Kni-Ran-Rog-Sam-Tou-Val-Wiz
To go: Mon-Pri

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20151013/45d18433/attachment-0001.sig>


More information about the bitcoin-dev mailing list