pub struct NodeState {
pub connected_peers: RwLock<HashMap<SocketAddr, PeerHandle>>,
pub mempool: MemPool,
pub is_syncing: RwLock<bool>,
pub chain_events: Sender<ChainEvent>,
pub adding_block: Mutex<()>,
/* private fields */
}Fields§
§connected_peers: RwLock<HashMap<SocketAddr, PeerHandle>>§mempool: MemPool§is_syncing: RwLock<bool>§chain_events: Sender<ChainEvent>§adding_block: Mutex<()>Implementations§
Source§impl NodeState
impl NodeState
pub fn new_empty() -> SharedNodeState
Sourcepub fn last_seen_block(&self) -> Hash
pub fn last_seen_block(&self) -> Hash
Get the latest seen block
Sourcepub fn set_last_seen_block(&self, hash: Hash)
pub fn set_last_seen_block(&self, hash: Hash)
Set a new last seen block
Sourcepub fn last_seen_transactions(&self) -> Ref<'_, VecDeque<TransactionId>>
pub fn last_seen_transactions(&self) -> Ref<'_, VecDeque<TransactionId>>
Get the latest seen transactions
Sourcepub fn add_last_seen_transaction(&self, tx_id: TransactionId)
pub fn add_last_seen_transaction(&self, tx_id: TransactionId)
Add a new last seen transaction, removing the oldest if >500
pub async fn get_live_transaction_difficulty( &self, transaction_difficulty: [u8; 32], ) -> [u8; 32]
Auto Trait Implementations§
impl !Freeze for NodeState
impl !RefUnwindSafe for NodeState
impl Send for NodeState
impl Sync for NodeState
impl Unpin for NodeState
impl !UnwindSafe for NodeState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more