mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-23 14:40:30 +01:00
test: wrap assertion in WaitPredicate in testMultiHopReceiverChainClaim
This commit is contained in:
parent
99cc4be448
commit
d0abb8219c
1 changed files with 20 additions and 6 deletions
26
lnd_test.go
26
lnd_test.go
|
@ -5467,13 +5467,22 @@ func testMultiHopReceiverChainClaim(net *lntest.NetworkHarness, t *harnessTest)
|
|||
if _, err := net.Miner.Node.Generate(1); err != nil {
|
||||
t.Fatalf("unable to mine block: %v", err)
|
||||
}
|
||||
pendingChanResp, err = carol.PendingChannels(ctxb, pendingChansRequest)
|
||||
err = lntest.WaitPredicate(func() bool {
|
||||
pendingChanResp, err = carol.PendingChannels(ctxb, pendingChansRequest)
|
||||
if err != nil {
|
||||
predErr = fmt.Errorf("unable to query for pending channels: %v", err)
|
||||
return false
|
||||
}
|
||||
if len(pendingChanResp.PendingForceClosingChannels) != 0 {
|
||||
predErr = fmt.Error("carol still has pending channels: %v",
|
||||
spew.Sdump(pendingChanResp))
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}, time.Second*15)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to query for pending channels: %v", err)
|
||||
}
|
||||
if len(pendingChanResp.PendingForceClosingChannels) != 0 {
|
||||
t.Fatalf("carol still has pending channels: %v",
|
||||
spew.Sdump(pendingChanResp))
|
||||
t.Fatalf(predErr.Error())
|
||||
}
|
||||
|
||||
// We'll close out the channel between Alice and Bob, then shutdown
|
||||
|
@ -6067,6 +6076,11 @@ func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest)
|
|||
t.Fatalf("unable to generate block: %v", err)
|
||||
}
|
||||
|
||||
_, err = waitForTxInMempool(net.Miner.Node, time.Second*10)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to find bob's sweeping transaction")
|
||||
}
|
||||
|
||||
// At this point, Bob should detect that he has no pending channels
|
||||
// anymore, as this just resolved it by the confirmation of the sweep
|
||||
// transaction we detected above.
|
||||
|
|
Loading…
Add table
Reference in a new issue