Enum nakamoto_p2p::fsm::Command
source · pub enum Command {
Show 15 variants
GetBlockByHeight(Height, Sender<Option<BlockHeader>>),
GetPeers(ServiceFlags, Sender<Vec<Peer>>),
GetTip(Sender<(Height, BlockHeader)>),
GetBlock(BlockHash),
GetFilters(RangeInclusive<Height>, Sender<Result<(), GetFiltersError>>),
Rescan {
from: Bound<Height>,
to: Bound<Height>,
watch: Vec<Script>,
},
Watch {
watch: Vec<Script>,
},
Broadcast(NetworkMessage, fn(_: Peer) -> bool, Sender<Vec<PeerId>>),
Query(NetworkMessage, Sender<Option<SocketAddr>>),
QueryTree(Arc<dyn Fn(&dyn BlockReader) + Send + Sync>),
Connect(SocketAddr),
Disconnect(SocketAddr),
ImportHeaders(Vec<BlockHeader>, Sender<Result<ImportResult, Error>>),
ImportAddresses(Vec<Address>),
SubmitTransaction(Transaction, Sender<Result<NonEmpty<PeerId>, CommandError>>),
}
Expand description
A command or request that can be sent to the protocol.
Variants
GetBlockByHeight(Height, Sender<Option<BlockHeader>>)
Get block header at height.
GetPeers(ServiceFlags, Sender<Vec<Peer>>)
Get connected peers.
GetTip(Sender<(Height, BlockHeader)>)
Get the tip of the active chain.
GetBlock(BlockHash)
Get a block from the active chain.
GetFilters(RangeInclusive<Height>, Sender<Result<(), GetFiltersError>>)
Get block filters.
Rescan
Fields
watch: Vec<Script>
Scripts to match on.
Rescan the chain for matching scripts and addresses.
Watch
Fields
watch: Vec<Script>
Scripts to watch.
Update the watchlist with the provided scripts.
Broadcast(NetworkMessage, fn(_: Peer) -> bool, Sender<Vec<PeerId>>)
Broadcast to peers matching the predicate.
Query(NetworkMessage, Sender<Option<SocketAddr>>)
Send a message to a random peer.
QueryTree(Arc<dyn Fn(&dyn BlockReader) + Send + Sync>)
Query the block tree.
Connect(SocketAddr)
Connect to a peer.
Disconnect(SocketAddr)
Disconnect from a peer.
ImportHeaders(Vec<BlockHeader>, Sender<Result<ImportResult, Error>>)
Import headers directly into the block store.
ImportAddresses(Vec<Address>)
Import addresses into the address book.
SubmitTransaction(Transaction, Sender<Result<NonEmpty<PeerId>, CommandError>>)
Submit a transaction to the network.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl !UnwindSafe for Command
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more