pub fn activation_height_from_headers<H>(
headers: &[H],
current_height: u64,
current_time: u64,
deployment: &Bip9Deployment,
) -> Option<u64>where
H: AsRef<BlockHeader>,Expand description
Computes the activation height for a BIP9 deployment from recent block headers.
headers– Last N block headers (oldest first), typically the 2016 blocks before the block we are validating. Must be the period ending atcurrent_height - 1.current_height– Height of the block we are validating.current_time– Network time (Unix timestamp) for start/timeout checks.deployment– BIP9 deployment (bit, start_time, timeout).
Returns Some(activation_height) when the last LOCK_IN_PERIOD headers (the retarget
window ending at current_height - 1) show ≥ACTIVATION_THRESHOLD signalling for
deployment.bit. Then activation_height = (period_index + 2) * 2016 where
period_index = (current_height - 1) / 2016 (BIP9: ACTIVE at start of period period_index + 2).
This does not mean rules are active at current_height yet; use
bip_validation::is_bip54_active_at(height, network, Some(activation_height)) for that.
When scanning the chain sequentially, merge multiple Some(h) values with h.min(...) so
an earlier period’s lock-in (smaller activation height) is not overwritten by a later window’s
larger computed height (see merge_bip54_activation_candidate).