From 10d07364232aadad2e7df1b97faef3f02d51575b Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Wed, 19 Nov 2025 10:39:27 +0000 Subject: [PATCH] test(snapshot): demonstrate leaking `generate()` goroutine --- core/state/snapshot/generate_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/state/snapshot/generate_test.go b/core/state/snapshot/generate_test.go index 4488630095..baff69435b 100644 --- a/core/state/snapshot/generate_test.go +++ b/core/state/snapshot/generate_test.go @@ -34,6 +34,7 @@ import ( "github.com/ethereum/go-ethereum/triedb/hashdb" "github.com/ethereum/go-ethereum/triedb/pathdb" "github.com/holiman/uint256" + "go.uber.org/goleak" "golang.org/x/crypto/sha3" ) @@ -53,6 +54,8 @@ func TestGeneration(t *testing.T) { } func testGeneration(t *testing.T, scheme string) { + defer goleak.VerifyNone(t) + // We can't use statedb to make a test trie (circular dependency), so make // a fake one manually. We're going with a small account trie of 3 accounts, // two of which also has the same 3-slot storage trie attached. @@ -80,9 +83,7 @@ func testGeneration(t *testing.T, scheme string) { checkSnapRoot(t, snap, root) // Signal abortion to the generator and wait for it to tear down - stop := make(chan *generatorStats) - snap.genAbort <- stop - <-stop + snap.stopGeneration() } // Tests that snapshot generation with existent flat state.