mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-25 16:23:49 +02:00
itest: use wait predicate for balance assertion in assertDLPExecuted
This assertion would at times fail if the wallet balance hadn't been updated yet.
This commit is contained in:
parent
6bb7b00a80
commit
f26cfac440
@ -9705,16 +9705,24 @@ func assertDLPExecuted(net *lntest.NetworkHarness, t *harnessTest,
|
|||||||
assertNumPendingChannels(t, carol, 0, 0)
|
assertNumPendingChannels(t, carol, 0, 0)
|
||||||
|
|
||||||
// Make sure Carol got her balance back.
|
// Make sure Carol got her balance back.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
err = wait.NoError(func() error {
|
||||||
carolBalResp, err := carol.WalletBalance(ctxt, balReq)
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
||||||
|
carolBalResp, err := carol.WalletBalance(ctxt, balReq)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("unable to get carol's balance: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
carolBalance := carolBalResp.ConfirmedBalance
|
||||||
|
if carolBalance <= carolStartingBalance {
|
||||||
|
return fmt.Errorf("expected carol to have balance "+
|
||||||
|
"above %d, instead had %v", carolStartingBalance,
|
||||||
|
carolBalance)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}, defaultTimeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to get carol's balance: %v", err)
|
t.Fatalf(err.Error())
|
||||||
}
|
|
||||||
carolBalance := carolBalResp.ConfirmedBalance
|
|
||||||
if carolBalance <= carolStartingBalance {
|
|
||||||
t.Fatalf("expected carol to have balance above %d, "+
|
|
||||||
"instead had %v", carolStartingBalance,
|
|
||||||
carolBalance)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assertNodeNumChannels(t, dave, 0)
|
assertNodeNumChannels(t, dave, 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user