test: extend closeChannelAndAssert to also check that channel is no longer pending close
In this commit, we extend the closeChannelAndAssert testing utility function to ensure that the channel is no longer marked as "pending close" in the database. With this change, we hop to catch a recently reported issue wherein users report that a co-op close channel has been fully confirmed, yet it still pops up in the `pendingchannels` command.
This commit is contained in:
parent
f61a71b6fc
commit
f052f18312
28
lnd_test.go
28
lnd_test.go
@ -234,7 +234,7 @@ func closeChannelAndAssert(ctx context.Context, t *harnessTest,
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, generate a single block, wait for the final close status
|
||||
// We'll now, generate a single block, wait for the final close status
|
||||
// update, then ensure that the closing transaction was included in the
|
||||
// block.
|
||||
block := mineBlocks(t, net, 1)[0]
|
||||
@ -246,6 +246,32 @@ func closeChannelAndAssert(ctx context.Context, t *harnessTest,
|
||||
|
||||
assertTxInBlock(t, block, closingTxid)
|
||||
|
||||
// Finally, the transaction should no longer be in the pending close
|
||||
// state as we've just mined a block that should include the closing
|
||||
// transaction. This only applies for co-op close channels though.
|
||||
if !force {
|
||||
err = lntest.WaitPredicate(func() bool {
|
||||
pendingChansRequest := &lnrpc.PendingChannelsRequest{}
|
||||
pendingChanResp, err := node.PendingChannels(
|
||||
ctx, pendingChansRequest,
|
||||
)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, pendingClose := range pendingChanResp.PendingClosingChannels {
|
||||
if pendingClose.Channel.ChannelPoint == chanPointStr {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}, time.Second*15)
|
||||
if err != nil {
|
||||
t.Fatalf("closing transaction not marked as fully closed")
|
||||
}
|
||||
}
|
||||
|
||||
return closingTxid
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user