mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
Three fixes for single-node consensus (--dev mode, K=1): 1. Self-voting: when K=1 and all sampled validators are self, deliver a self-vote via callback instead of polling 0 peers. 2. Block acceptance: call Verify() before Accept() — PlatformVM requires block state prepared during Verify(). Without it, Accept() fails silently due to missing block state. 3. DrainAccepted: after each VM notification, check for blocks that consensus accepted and call their Verify+Accept pipeline. Multi-node consensus (K>1) is unchanged — self-voting only activates when K=1 and no external validators exist in the sample. Tests: - TestSingleNodeSelfVote: K=1 self-votes, no network queries - TestMultiNodeDoesNotSelfVote: K=3 uses network, no self-vote - TestSelfVoterNilWhenKGreaterThan1: callback only for K=1