BlockLocatorFromHash returns a block locator for the passed block hash. See BlockLocator for details on the algorithm used to create a block locator.
In addition to the general algorithm referenced above, there are a couple of special cases which are handled:
- If the genesis hash is passed, there are no previous hashes to add and therefore the block locator will only consist of the genesis hash - If the passed hash is not currently known, the block locator will only consist of the passed hash
This function is safe for concurrent access.
// final one the remote peer knows about (zero // stop hash). locator := b.chain.BlockLocatorFromHash(&iv.Hash) imsg.peer.PushGetBlocksMsg(locator, &zeroHash) }