Skip to main content

make_signed_block_reserved_fields

Function make_signed_block_reserved_fields 

Source
pub fn make_signed_block_reserved_fields(
    prev_hash: [u8; 32],
    height: u64,
    timestamp_ms: u64,
    payload_canonical: &[u8],
    signer_pubkey: [u8; 32],
    signature: Vec<u8>,
) -> (Vec<(String, Value)>, [u8; 32])
Expand description

Build the reserved-column field list + hash for a new block on a signed chain. Caller supplies the row’s canonical payload bytes (engine’s canonical payload encoder, identical to what the client signed) and the signer fields produced by the client.

Genesis exemption: when height == 0, the caller passes GENESIS_SIGNER_PUBKEY / GENESIS_SIGNATURE markers.

The returned hash binds the signer fields per compute_block_hash, so any subsequent tampering with either reserved column makes the per-block hash check fail in verify_chain.