pub struct NodeState {
Show 23 fields pub pindex_best_known_block: Option<Arc<BlockIndex>>, pub hash_last_unknown_block: u256, pub pindex_last_common_block: Option<Arc<BlockIndex>>, pub pindex_best_header_sent: Option<Arc<BlockIndex>>, pub n_unconnecting_headers: AtomicI32, pub sync_started: AtomicBool, pub headers_sync_timeout: Option<OffsetDateTime>, pub stalling_since: Option<OffsetDateTime>, pub blocks_in_flight: Vec<QueuedBlock>, pub downloading_since: OffsetDateTime, pub n_blocks_in_flight: AtomicI32, pub preferred_download: AtomicBool, pub prefer_headers: AtomicBool, pub prefer_header_and_ids: AtomicBool, pub provides_header_and_ids: AtomicBool, pub have_witness: AtomicBool, pub wants_cmpct_witness: AtomicBool, pub supports_desired_cmpct_version: AtomicBool, pub chain_sync: NodeStateChainSyncTimeoutState, pub last_block_announcement: Option<OffsetDateTime>, pub is_inbound: AtomicBool, pub recently_announced_invs: RollingBloomFilter, pub wtxid_relay: AtomicBool,
}
Expand description

| Maintain validation-specific state | about nodes, protected by CS_MAIN, | instead by Node’s own locks. This simplifies | asynchronous operation, where processing | of incoming data is done after the ProcessMessage | call returns, and we’re no longer holding | the node’s locks. |

Fields§

§pindex_best_known_block: Option<Arc<BlockIndex>>

| The best known block we know this peer | has announced. |

§hash_last_unknown_block: u256

| The hash of the last unknown block this | peer has announced. |

§pindex_last_common_block: Option<Arc<BlockIndex>>

| The last full block we both have. |

§pindex_best_header_sent: Option<Arc<BlockIndex>>

| The best header we have sent our peer. |

§n_unconnecting_headers: AtomicI32

| Length of current-streak of unconnecting | headers announcements |

§sync_started: AtomicBool

| Whether we’ve started headers synchronization | with this peer. |

§headers_sync_timeout: Option<OffsetDateTime>

| When to potentially disconnect peer | for stalling headers download |

§stalling_since: Option<OffsetDateTime>

| Since when we’re stalling block download | progress (in microseconds), or 0. |

§blocks_in_flight: Vec<QueuedBlock>§downloading_since: OffsetDateTime

| When the first entry in vBlocksInFlight | started downloading. Don’t care when | vBlocksInFlight is empty. |

§n_blocks_in_flight: AtomicI32§preferred_download: AtomicBool

| Whether we consider this a preferred | download peer. |

§prefer_headers: AtomicBool

| Whether this peer wants invs or headers | (when possible) for block announcements. |

§prefer_header_and_ids: AtomicBool

| Whether this peer wants invs or cmpctblocks | (when possible) for block announcements. |

§provides_header_and_ids: AtomicBool

| Whether this peer will send us cmpctblocks | if we request them. | | This is not used to gate request logic, | as we really only care about fSupportsDesiredCmpctVersion, | but is used as a flag to “lock in” the version | of compact blocks (fWantsCmpctWitness) | we send. |

§have_witness: AtomicBool

| Whether this peer can give us witnesses |

§wants_cmpct_witness: AtomicBool

| Whether this peer wants witnesses in | cmpctblocks/blocktxns |

§supports_desired_cmpct_version: AtomicBool

| If we’ve announced NODE_WITNESS to | this peer: whether the peer sends witnesses | in cmpctblocks/blocktxns, otherwise: | whether this peer sends non-witnesses | in cmpctblocks/blocktxns. |

§chain_sync: NodeStateChainSyncTimeoutState§last_block_announcement: Option<OffsetDateTime>

| Time of last new block announcement |

§is_inbound: AtomicBool

| Whether this peer is an inbound connection |

§recently_announced_invs: RollingBloomFilter

| A rolling bloom filter of all announced | tx CInvs to this peer. | = CRollingBloomFilter{INVENTORY_MAX_RECENT_RELAY, 0.000001}; |

§wtxid_relay: AtomicBool

| Whether this peer relays txs via wtxid |

Implementations§

source§

impl NodeState

source

pub fn blocks_in_flight_iter(&mut self) -> QueuedBlockIter

source

pub fn new(is_inbound: bool) -> Self

source

pub fn detect_stalling(&self, current_time: OffsetDateTime) -> bool

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T, U> CastInto<U> for Twhere U: CastFrom<T>,

§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> StaticUpcast<T> for T

§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V