pub struct Tracker { /* private fields */ }Expand description
A host’s tracked transactions, with indexes for targeted chain events. Hints, ages and spend attempts name one transaction. A tip uses only the suspect set; reorgs, forks and splits use only the relevant mined height range.
Implementations§
Source§impl Tracker
impl Tracker
Sourcepub fn track(&mut self, txid: impl Into<TxId>) -> &State
pub fn track(&mut self, txid: impl Into<TxId>) -> &State
Begin tracking one transaction; repeating this does not erase its state.
Sourcepub fn restore(&mut self, state: State) -> Option<State>
pub fn restore(&mut self, state: State) -> Option<State>
Hold a state restored by State::from_compact and index it as a
transition would; a restored mined word joins the suspect set, so the
next tip rechecks it. The state it replaces, if the txid was tracked.
Sourcepub fn get(&self, txid: &str) -> Option<&State>
pub fn get(&self, txid: &str) -> Option<&State>
An immutable state, or none when the host does not track this txid.
Sourcepub fn apply<H: Headers + ?Sized>(
&mut self,
txid: &str,
headers: &H,
input: Input,
) -> Result<(), CheckError>
pub fn apply<H: Headers + ?Sized>( &mut self, txid: &str, headers: &H, input: Input, ) -> Result<(), CheckError>
Apply an input to one transaction and maintain the event indexes, including after a failed proof or header lookup.
§Errors
The CheckError of State::step for that transaction.
Sourcepub fn on_chain<H: Headers + ?Sized>(
&mut self,
headers: &H,
event: ChainEvent,
) -> Vec<ChainUpdate>
pub fn on_chain<H: Headers + ?Sized>( &mut self, headers: &H, event: ChainEvent, ) -> Vec<ChainUpdate>
Deliver an evidence event only to the set it names. The output contains every selected txid and each fault for the host to report.
The selection is the bound of the recheck, never the stale mark: a
reorg names the mined words at or above its fork height and an
invalidation the words checked against its block, and each is rechecked
against headers by its stored root. Only a word whose root moved
comes back with Reask::Reorg; a host fetches proofs for those
alone, a few a pass, the pacing being the host’s.