From fe563daa513525658f3ab76ece9cfd227a6a2bbc Mon Sep 17 00:00:00 2001 From: Jason Yellick Date: Wed, 8 May 2024 17:22:38 -0400 Subject: [PATCH] Add additional check that deposit txes included This additionally removes the 'abort' path inside of the add mining txes code when dealing with deposit txes. --- eth/stagedsync/stage_mining_exec.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eth/stagedsync/stage_mining_exec.go b/eth/stagedsync/stage_mining_exec.go index 90395618d3c..d140b072e1d 100644 --- a/eth/stagedsync/stage_mining_exec.go +++ b/eth/stagedsync/stage_mining_exec.go @@ -125,11 +125,16 @@ func SpawnMiningExecStage(s *StageState, tx kv.RwTx, cfg MiningExecCfg, quit <-c } depTS := types.NewTransactionsFixedOrder(txs) - logs, _, err := addTransactionsToMiningBlock(logPrefix, current, cfg.chainConfig, cfg.vmConfig, getHeader, cfg.engine, depTS, cfg.miningState.MiningConfig.Etherbase, ibs, quit, cfg.interrupt, cfg.payloadId, logger) + // Note, we do not allow early interrupt of adding deposit txes to the + // block, as they must all be included. + logs, _, err := addTransactionsToMiningBlock(logPrefix, current, cfg.chainConfig, cfg.vmConfig, getHeader, cfg.engine, depTS, cfg.miningState.MiningConfig.Etherbase, ibs, quit, nil, cfg.payloadId, logger) log.Debug("addTransactionsToMiningBlock (deposit) result", "err", err, "logs", logs) if err != nil { return err } + if len(current.Txs) != len(current.Deposits) { + return fmt.Errorf("all deposit transactions must commit but only %d of %d did", len(current.Txs), len(txs)) + } } if txs != nil && !txs.Empty() {