utxonursery: assert empty database
This commit is contained in:
parent
b5da791271
commit
b89db6d614
@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"reflect"
|
||||
"sync"
|
||||
"testing"
|
||||
@ -515,7 +516,8 @@ func (ctx *nurseryTestContext) finish() {
|
||||
select {
|
||||
case <-signalChan:
|
||||
case <-time.After(time.Second):
|
||||
ctx.t.Fatalf("lingering goroutines detected after test is finished")
|
||||
ctx.t.Fatalf("lingering goroutines detected after test " +
|
||||
"is finished")
|
||||
}
|
||||
|
||||
// Restore waitgroup state to what it was before.
|
||||
@ -530,6 +532,25 @@ func (ctx *nurseryTestContext) finish() {
|
||||
ctx.t.Fatalf("unexpected transactions published")
|
||||
default:
|
||||
}
|
||||
|
||||
// Assert that the database is empty. All channels removed and height
|
||||
// index cleared.
|
||||
nurseryChannels, err := ctx.nursery.cfg.Store.ListChannels()
|
||||
if err != nil {
|
||||
ctx.t.Fatal(err)
|
||||
}
|
||||
if len(nurseryChannels) > 0 {
|
||||
ctx.t.Fatalf("Expected all channels to be removed from store")
|
||||
}
|
||||
|
||||
activeHeights, err := ctx.nursery.cfg.Store.HeightsBelowOrEqual(
|
||||
math.MaxUint32)
|
||||
if err != nil {
|
||||
ctx.t.Fatal(err)
|
||||
}
|
||||
if len(activeHeights) > 0 {
|
||||
ctx.t.Fatalf("Expected height index to be empty")
|
||||
}
|
||||
}
|
||||
|
||||
func createOutgoingRes(onLocalCommitment bool) *lnwallet.OutgoingHtlcResolution {
|
||||
|
Loading…
Reference in New Issue
Block a user