Skip to content

Commit

Permalink
fix: remove block from pending after finalization
Browse files Browse the repository at this point in the history
This prevents from memory leaking and makes it impossible to `SetFinal`
more than once.
  • Loading branch information
tzdybal committed Dec 3, 2024
1 parent 1692830 commit 4f56d58
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions test/dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func (e *DummyExecutor) ExecuteTxs(ctx context.Context, txs []types.Tx, blockHei
func (e *DummyExecutor) SetFinal(ctx context.Context, blockHeight uint64) error {
if pending, ok := e.pendingRoots[blockHeight]; ok {
e.stateRoot = pending
delete(e.pendingRoots, blockHeight)
return nil
}
return fmt.Errorf("cannot set finalized block at height %d", blockHeight)
Expand Down

0 comments on commit 4f56d58

Please sign in to comment.