Initial getheaders request

Initial getheaders request
From: Daniel Kraft @ 2015-10-13 11:02 UTC ( / )
  To: bitcoin-dev



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