mirror of
https://github.com/luxfi/consensus.git
synced 2026-07-29 00:25:15 +00:00
fix(engine): log consensus.AddBlock rejections instead of dropping them silently
Companion to the Verify silent-drop fix. AddBlock's only rejection is 'block already exists', which a self-built block hits whenever the VM re-mints an identical envelope (proposervm truncates the block timestamp to a whole second, so rebuilds within that second share a blkID). The bare continue skipped Propose/RequestVotes, so the block never reached peers and never got decided, while the VM re-notified on still-pending txs — a silent rebuild storm with the chain pinned at its height and nothing logged.
This commit is contained in:
@@ -3824,6 +3824,19 @@ func (t *Transitive) buildBlocksLocked(ctx context.Context) error {
|
||||
t.mu.Lock()
|
||||
|
||||
if addErr != nil {
|
||||
// Same silent-drop class as the Verify failure above. consensus.AddBlock's only
|
||||
// rejection is "block already exists" — which a self-built block hits whenever the
|
||||
// VM re-mints an IDENTICAL envelope (the proposervm block timestamp is truncated to
|
||||
// a whole second, so every rebuild inside that second yields the SAME blkID). The
|
||||
// bare continue then skipped Propose/RequestVotes entirely: the block was never sent
|
||||
// to peers, never voted on, never decided — while the VM kept re-notifying because
|
||||
// its txs were still pending. Result: a silent rebuild storm with the chain pinned at
|
||||
// its height and no log line naming the cause. Log it at the point of the drop.
|
||||
t.log.Error("built block rejected by consensus — dropping",
|
||||
"blkID", vmBlock.ID(),
|
||||
"height", vmBlock.Height(),
|
||||
"parentID", vmBlock.ParentID(),
|
||||
"error", addErr)
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user