Enum nakamoto_node::client::Event
source · [−]pub enum Event {
Show 13 variants
Ready {
tip: u64,
filter_tip: u64,
},
PeerConnected {
addr: SocketAddr,
link: Link,
},
PeerDisconnected {
addr: SocketAddr,
reason: DisconnectReason<DisconnectReason>,
},
PeerConnectionFailed {
addr: SocketAddr,
error: Arc<Error>,
},
PeerNegotiated {
addr: SocketAddr,
link: Link,
services: ServiceFlags,
height: u64,
user_agent: String,
version: u32,
},
PeerHeightUpdated {
height: u64,
},
BlockConnected {
header: BlockHeader,
hash: BlockHash,
height: u64,
},
BlockDisconnected {
header: BlockHeader,
hash: BlockHash,
height: u64,
},
BlockMatched {
hash: BlockHash,
header: BlockHeader,
height: u64,
transactions: Vec<Transaction, Global>,
},
FeeEstimated {
block: BlockHash,
height: u64,
fees: FeeEstimate,
},
FilterProcessed {
block: BlockHash,
height: u64,
matched: bool,
valid: bool,
},
TxStatusChanged {
txid: Txid,
status: TxStatus,
},
Synced {
height: u64,
tip: u64,
},
}Expand description
Event emitted by the client.
Variants
Ready
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
Fields
addr: SocketAddrPeer address.
reason: DisconnectReason<DisconnectReason>Reason for disconnection.
Peer disconnected after successful connection.
PeerConnectionFailed
Connection was never established and timed out or failed.
PeerNegotiated
Fields
addr: SocketAddrPeer address.
link: LinkConnection link.
height: u64Peer height.
user_agent: StringPeer user agent.
version: u32Negotiated protocol version.
Peer handshake completed. The peer connection is fully functional from this point.
PeerHeightUpdated
Fields
height: u64Best 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
A block was added to the main chain.
BlockDisconnected
Fields
height: u64Height 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
Fields
height: u64Block height.
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: u64Filter height (same as block).
matched: boolWhether or not this filter matched any of the watched scripts.
valid: boolWhether 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.