Skip to content

Commit

Permalink
Notify block builder of txs after reject (#2549)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph authored Dec 27, 2023
1 parent ee10054 commit 332a1b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vms/avm/block/executor/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ func (b *Block) Reject(context.Context) error {
}
}

// If we added transactions to the mempool, we should be willing to build a
// block.
b.manager.mempool.RequestBuildBlock()

b.rejected = true
return nil
}
Expand Down
2 changes: 2 additions & 0 deletions vms/avm/block/executor/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ func TestBlockReject(t *testing.T) {

mempool := mempool.NewMockMempool(ctrl)
mempool.EXPECT().Add(validTx).Return(nil) // Only add the one that passes verification
mempool.EXPECT().RequestBuildBlock()

preferredID := ids.GenerateTestID()
mockPreferredState := state.NewMockDiff(ctrl)
Expand Down Expand Up @@ -916,6 +917,7 @@ func TestBlockReject(t *testing.T) {
mempool := mempool.NewMockMempool(ctrl)
mempool.EXPECT().Add(tx1).Return(nil)
mempool.EXPECT().Add(tx2).Return(nil)
mempool.EXPECT().RequestBuildBlock()

preferredID := ids.GenerateTestID()
mockPreferredState := state.NewMockDiff(ctrl)
Expand Down

0 comments on commit 332a1b3

Please sign in to comment.