mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 12:46:44 +00:00
test(snapshot): demonstrate leaking generate() goroutine
This commit is contained in:
parent
e0d81d1e99
commit
10d0736423
1 changed files with 4 additions and 3 deletions
|
|
@ -34,6 +34,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/triedb/hashdb"
|
"github.com/ethereum/go-ethereum/triedb/hashdb"
|
||||||
"github.com/ethereum/go-ethereum/triedb/pathdb"
|
"github.com/ethereum/go-ethereum/triedb/pathdb"
|
||||||
"github.com/holiman/uint256"
|
"github.com/holiman/uint256"
|
||||||
|
"go.uber.org/goleak"
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -53,6 +54,8 @@ func TestGeneration(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testGeneration(t *testing.T, scheme string) {
|
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
|
// 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,
|
// 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.
|
// 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)
|
checkSnapRoot(t, snap, root)
|
||||||
|
|
||||||
// Signal abortion to the generator and wait for it to tear down
|
// Signal abortion to the generator and wait for it to tear down
|
||||||
stop := make(chan *generatorStats)
|
snap.stopGeneration()
|
||||||
snap.genAbort <- stop
|
|
||||||
<-stop
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that snapshot generation with existent flat state.
|
// Tests that snapshot generation with existent flat state.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue