pub struct Node {
pub probe: Probe,
pub validators: Vec<Validator>,
pub chain: Chain,
pub mempool: Mempool,
pub max_block_txs: usize,
pub live_beacon: Option<String>,
}Expand description
A network participant.
Fields§
§probe: ProbeThis node’s post-quantum identity.
validators: Vec<Validator>The validator set (shared, agreed configuration).
chain: ChainThis node’s view of the chain.
mempool: MempoolPending transactions.
max_block_txs: usizeMax transactions per block.
live_beacon: Option<String>A live beacon value fetched externally for the current round, if any (see
entropa_core::beacon::sample_live). Set this once per round before calling
is_proposer/try_produce so both see the identical value — fetching live
separately in each would risk straddling a beacon update between the two calls.
None falls back to the deterministic beacon::sample(round).
Implementations§
Source§impl Node
impl Node
pub fn new(probe: Probe, validators: Vec<Validator>) -> Self
Sourcepub fn submit(&mut self, tx: Transaction)
pub fn submit(&mut self, tx: Transaction)
Submit a transaction into this node’s mempool.
Sourcepub fn is_proposer(&self, round: u64) -> bool
pub fn is_proposer(&self, round: u64) -> bool
Am I the beacon-selected proposer for round?
Sourcepub fn try_produce(&mut self, round: u64, timestamp: u64) -> Option<Block>
pub fn try_produce(&mut self, round: u64, timestamp: u64) -> Option<Block>
If this node is the beacon-selected proposer for round, drain the mempool,
produce and append the next block, and return it for broadcast. Otherwise None.
Sourcepub fn accept(&mut self, block: Block) -> Result<(), NodeError>
pub fn accept(&mut self, block: Block) -> Result<(), NodeError>
Accept a peer’s block: enforce the consensus rule (correct proposer for the block’s beacon), then full structural + post-quantum validation.