From 71c93764b9898f736f91d6bd116cc3c45566e048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Tue, 3 Dec 2024 17:26:17 +0100 Subject: [PATCH] fix: remove block from pending after finalization This prevents from memory leaking and makes it impossible to `SetFinal` more than once. --- test/dummy.go | 1 + 1 file changed, 1 insertion(+) diff --git a/test/dummy.go b/test/dummy.go index 0c45ed8..93be076 100644 --- a/test/dummy.go +++ b/test/dummy.go @@ -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)