Struct bitcoin_peerman::NodeState
source · 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 |