0
How many block locator hashes are sent in a getblocks message? And how distant are these locator hashes from one another?
0
How many block locator hashes are sent in a getblocks message? And how distant are these locator hashes from one another?
0
getblocks message pushes a maximum of 500 block invs to the caller. It will lookup the given block locater in the active chain and pushes up to 500 MSG_BLOCK invs to the caller (it might stop earlier because the called node reaches the chain tip). The corresponding code for bitcoin-core 0.10 can be found here (https://github.com/bitcoin/bitcoin/blob/0.10/src/main.cpp#L3888).
Also notice that bitcoin-core now uses the headers first approach and therefore getblocks is no longer in use when acting as a "calling node".
What was actually confusing me was teh description on Bitcoin Wiki, here. According to this description I imagine block locators being like distant markers on a blockchain - not being pushed into
– Aliakbar Ahmadi – 2015-06-03T13:02:41.060invnecessarily consecutively. Let's say one node0's last seen block was block #40 and the best tip is at block #45. Will node0 then send block locators/header hashes in itsgetblocksmessage in this pattern [#1, #2, #3, ..., #40]? or as "distant" markers like e.g. [#10, #25, #30, #35, ..., #40]?Check L3892 (https://github.com/bitcoin/bitcoin/blob/0.10/src/main.cpp#L3892). As far as i see only one locator is supported. So your node0 should send its top block hash within the getheaders message. Consider also reading: https://bitcoin.org/en/developer-reference#getblocks and you could also follow the
– Jonas Schnelli – 2015-06-03T13:23:27.843CNodeshashContinuevariable.Ok, but upon reading bitcoin.org/en/developer-reference#getblocks, it says "One or more block header hashes ..." and with your hint of
hashContinueand the fact thatnLimitis decremented I'd claim that a consecutive order of multiple header hashes inside the inventory field sounds more plausible!? – Aliakbar Ahmadi – 2015-06-03T13:38:28.0131I think you/we mix up getblocks message with the inv response. The
getblocksmessage should probably only contain one block locater and a optional hash stop. The called node will response yourgetblocksmessage with serval invs containing all blockhashes that where found on the called node after your given block locater up to hash-stop or a max. of 500 blocks. If the node already sent you a block hash inv, it might be skipped.nLimitis decremented to make sure you won't get more than 500invs. – Jonas Schnelli – 2015-06-03T14:47:45.830Yes I also think we're talking of different things. I'm actually referring to bitcoin.org/en/developer-reference#getblocks and in particular to https://bitcoin.org/img/dev/en-ibd-getblocks.svg where it also says "header hashes" whereas you say "The getblocks message should probably only contain one block locater and a optional hash stop."
– Aliakbar Ahmadi – 2015-06-03T14:54:29.260What do you think? – Aliakbar Ahmadi – 2015-06-04T09:58:18.973