Skip to main content

MAX_CHAIN_LENGTH

Constant MAX_CHAIN_LENGTH 

Source
pub const MAX_CHAIN_LENGTH: u8 = 255;
Expand description

The highest chain index: the hash chain’s incremental range over its anchor (ADR 003 §Chain length and rollover).

The index space is the u8 domain 0..=255 — 256 slots, exactly one byte. Index 0 names chain_root and resolves to the voucher’s own amount, so the base voucher is payable with no chain at all; it adds no increment, which is why it never travels the wire. Indices 1..=255 each release one preimage and add one chunk_price over that anchor, so a chain adds up to 255 MiB at CHUNK_BYTES. 256 slots = one payable base + 255 increments.