Enum nakamoto_client::Event
source · pub enum Event {
Show 13 variants
Ready {
tip: Height,
filter_tip: Height,
},
PeerConnected {
addr: PeerId,
link: Link,
},
PeerDisconnected {
addr: PeerId,
reason: Disconnect<DisconnectReason>,
},
PeerConnectionFailed {
addr: PeerId,
error: Arc<Error>,
},
PeerNegotiated {
addr: PeerId,
link: Link,
services: ServiceFlags,
height: Height,
user_agent: String,
version: u32,
},
PeerHeightUpdated {
height: Height,
},
BlockConnected {
header: BlockHeader,
hash: BlockHash,
height: Height,
},
BlockDisconnected {
header: BlockHeader,
hash: BlockHash,
height: Height,
},
BlockMatched {
hash: BlockHash,
header: BlockHeader,
height: Height,
transactions: Vec<Transaction>,
},
FeeEstimated {
block: BlockHash,
height: Height,
fees: FeeEstimate,
},
FilterProcessed {
block: BlockHash,
height: Height,
matched: bool,
valid: bool,
},
TxStatusChanged {
txid: Txid,
status: TxStatus,
},
Synced {
height: Height,
tip: Height,
},
}
Expand description
Event emitted by the client, after the “loading” phase is over.
Variants
Ready
Fields
tip: Height
The tip of the block header chain.
filter_tip: Height
The tip of the filter header chain.
Ready to process peer events and start receiving commands. Note that this isn’t necessarily the first event emitted.
PeerConnected
Peer connected. This is fired when the physical TCP/IP connection
is established. Use Event::PeerNegotiated
to know when the P2P handshake
has completed.
PeerDisconnected
Peer disconnected after successful connection.
PeerConnectionFailed
Connection was never established and timed out or failed.
PeerNegotiated
Fields
addr: PeerId
Peer address.
link: Link
Connection link.
height: Height
Peer height.
user_agent: String
Peer user agent.
version: u32
Negotiated protocol version.
Peer handshake completed. The peer connection is fully functional from this point.
PeerHeightUpdated
Fields
height: Height
Best block height known.
The best known height amongst connected peers has been updated. Note that there is no guarantee that this height really exists; peers don’t have to follow the protocol and could send a bogus height.
BlockConnected
Fields
height: Height
Height of the block.
A block was added to the main chain.
BlockDisconnected
Fields
height: Height
Height of the block when it was part of the main chain.
One of the blocks of the main chain was reverted, due to a re-org. These events will fire from the latest block starting from the tip, to the earliest. Mark all transactions belonging to this block as unconfirmed.
BlockMatched
A block has matched one of the filters and is ready to be processed.
This event usually precedes Event::TxStatusChanged
events.
FeeEstimated
Transaction fee rate estimated for a block.
FilterProcessed
Fields
height: Height
Filter height (same as block).
matched: bool
Whether or not this filter matched any of the watched scripts.
valid: bool
Whether or not this filter is valid.
A filter was processed. If it matched any of the scripts in the watchlist,
the corresponding block was scheduled for download, and a Event::BlockMatched
event will eventually be fired.
TxStatusChanged
The status of a transaction has changed.
Synced
Compact filters have been synced and processed up to this point and matching blocks have been fetched.
If filters have been processed up to the last block in the client’s header chain, height
and tip
will be equal.