Stopping Hash field in GetBlocks Message

3

Reading Bitcoin Developer Guide, I couldn't fully answer following question:
What is the exact purpose of the Stopping Hash field inside a GetBlocks Message?

Aliakbar Ahmadi

Posted 2015-05-05T14:12:51.613

Reputation: 1 335

Answers

5

Node1 announces block B3, using an 'inv' message with B3's gash.

Node2 does not know about B3, or its parent B2, but does know the grandparent B1. It sends a getblocks message, starting from B1, but stopping at B3.

Node1 replies with an inv for B2, but not with B3 or any potential successor B4 thay may have appeared.

The purpose is just avoiding sending too many hashes in case the sender already knows some successor.

Note that since Bitcoin Core 0.10.0, getblocks is no longer used. getheaders has similar logic though.

Pieter Wuille

Posted 2015-05-05T14:12:51.613

Reputation: 54 032

By "[...], but stopping at B3" you mean that Node2 requests only 1 block saying "give me B2's hash but not B3's hash"? So can we say Stopping Hash defines how many block header hashes are requested, unlike the default 00000..00000 Stopping Hash?Aliakbar Ahmadi 2015-05-05T15:16:17.937

1No, not how many. Just the one after which the sender can stop.Pieter Wuille 2015-05-05T16:35:55.443