miner: don't update the pending block, fix tests

This commit is contained in:
Marius van der Wijden 2023-11-24 10:55:12 +01:00
parent ab0d224c73
commit 72f4467c0d
2 changed files with 6 additions and 4 deletions

View file

@ -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

View file

@ -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