Skip to main content

Module chain_rule_hash

Module chain_rule_hash 

Source
Expand description

Lock-free holder for the current rule hash (ADR-103 A7).

The chain calls its rule_hash provider while holding the chain lock, so the provider must not take locks. RuleHashCell is the intended source: writers publish with RuleHashCell::set, the provider reads with RuleHashCell::get, and a read never takes a lock (a seqlock over four atomic words). A reader only retries while a write is in flight, which is a few instructions; it spins briefly and then yields, so it is lock-free in the sense that matters here (no mutex, no priority inversion on the chain lock) but not wait-free.

Structsยง

RuleHashCell
The current rule hash, readable without locking.