From 72f4467c0df0089e610dc7c3e8a3bed0a3875fa3 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Fri, 24 Nov 2023 10:55:12 +0100 Subject: [PATCH] miner: don't update the pending block, fix tests --- ethclient/ethclient_test.go | 8 +++++--- miner/worker.go | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ethclient/ethclient_test.go b/ethclient/ethclient_test.go index 4aa25759fb..dab70288aa 100644 --- a/ethclient/ethclient_test.go +++ b/ethclient/ethclient_test.go @@ -598,8 +598,9 @@ func testAtFunctions(t *testing.T, client *rpc.Client) { if err != nil { t.Fatalf("unexpected error: %v", err) } - if pending != 1 { - t.Fatalf("unexpected pending, wanted 1 got: %v", pending) + // After nerfing the pending block, pending transaction count will be 0 + if pending != 0 { + t.Fatalf("unexpected pending, wanted 0 got: %v", pending) } // Query balance balance, err := ec.BalanceAt(context.Background(), testAddr, nil) @@ -617,7 +618,8 @@ func testAtFunctions(t *testing.T, client *rpc.Client) { if err != nil { t.Fatalf("unexpected error: %v", err) } - if balance.Cmp(penBalance) == 0 { + // After nerfing the pending block, pending balance will be equal to balance + if balance.Cmp(penBalance) != 0 { t.Fatalf("unexpected balance: %v %v", balance, penBalance) } // NonceAt diff --git a/miner/worker.go b/miner/worker.go index 2b4714f0ca..f8e7f16e63 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -533,7 +533,7 @@ func (w *worker) mainLoop() { // Note all transactions received may not be continuous with transactions // already included in the current sealing block. These transactions will // be automatically eliminated. - if !w.isRunning() && w.current != nil { + if !w.chainConfig.TerminalTotalDifficultyPassed && !w.isRunning() && w.current != nil { // If block is already full, abort if gp := w.current.gasPool; gp != nil && gp.Gas() < params.TxGas { continue