I have been experimenting with getheaders
and one thing I can't seem to figure out is how to get a header for a specific hash, because getheaders
doesn't provide this feature.
According to the documentation (and from my own experiments), it looks like the start position provided to the API is NOT included in the header results.
Return a headers packet containing the headers of blocks starting right after the last known hash in the block locator object, up to hash_stop or 2000 blocks
I get that this is for the purpose of synchronizing, so the semantic is "I know about this block hash, so send me all the rest I haven't seen yet, which doesn't include this hash".
But with this there's no way to figure out a block header from a block hash, I always need the previous block's hash to get the current block header. Is there no P2P API (or any trick) that lets me take a block hash and get block headers back?