async fn advertiser_if_parent_contradicts<ZS>(
state: ZS,
parent_hash: Hash,
block_height: Height,
advertiser_addr: Option<PeerSocketAddr>,
) -> Option<PeerSocketAddr>Expand description
Returns advertiser_addr if the parent header Zebra already holds proves that a gossiped block’s
claimed block_height was rewritten, and None if there is no such proof.
§Security
A peer can answer a BlockDownload request with a canonical header and a rewritten coinbase
height, because the coinbase scriptSig is excluded from the V5 transaction ID and therefore from
the block hash (ZIP-244). The hash check passes, so the forged height reaches the height limit
drops before consensus validation. Peers also legitimately serve blocks that are genuinely far
ahead of the tip or genuinely older than the finalized tip, so the drop is only attributed to the
supplying peer when the parent header Zebra holds contradicts the claimed height: a block’s height
is one more than its parent’s, so a held parent whose height disagrees proves the body was
rewritten, whichever limit the claimed height crossed.
A parent Zebra does not hold, a height consistent with the parent, and a failed or timed-out lookup are all treated as no proof, so honest peers are never scored and a slow state read costs the peer nothing. (GHSA-4f6v-mj46-gxg3, the inbound-gossip sibling of GHSA-g95h-hw6g-pvgv.)