core/rawdb: close database in test to avoid goroutine leak (#23287)

* add db close to avoid goroutine leak

* core/rawdb: move close to defer

Co-authored-by: Martin Holst Swende <martin@swende.se>
This commit is contained in:
Shihao Xia 2021-08-08 09:44:42 -04:00 committed by GitHub
parent 8a24b56331
commit 9e59474e46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -444,6 +444,7 @@ func TestAncientStorage(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("failed to create database with ancient backend") t.Fatalf("failed to create database with ancient backend")
} }
defer db.Close()
// Create a test block // Create a test block
block := types.NewBlockWithHeader(&types.Header{ block := types.NewBlockWithHeader(&types.Header{
Number: big.NewInt(0), Number: big.NewInt(0),