Avoid processing a carried-over NEAR chunk twice

A block carries chunk headers for shards even when a shard has no newly included chunk at that height. Iterating every header as fresh work can double-count activity.

Compare inclusion height with block height

Read the block and its chunks array. For each header record chunk_hash, shard_id and height_included. Compare height_included with the containing block’s header.height. Keep height_created separately when measuring delays.

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "block",
  "params": {
    "finality": "final"
  }
}

Key imports by the chunk identity

At block 510, a header with height_included 509 refers to an earlier inclusion. A different header whose height_included equals 510 represents a new inclusion in this block. Fetch the latter using the chunk method with chunk_id set to its hash. Persist the hash as a uniqueness key before applying aggregate counts.

A carried-over header and a newly included chunk with zero transactions represent different conditions. Track them separately when estimating shard availability.

Sources