Files
consensus/pkg/cpp
zeekay 4ae55610ef fix: --dev single-node mode P-Chain block finalization
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
2026-04-02 13:40:05 -07:00
..