diff --git a/lnd_test.go b/lnd_test.go index f985cacc..a3857790 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -2980,7 +2980,7 @@ func testBidirectionalAsyncPayments(net *networkHarness, t *harnessTest) { if err != nil { t.Fatalf(err.Error()) } - case <-time.After(time.Second * maxTime): + case <-time.After(maxTime): t.Fatalf("waiting for payments to finish too long "+ "(%v)", maxTime) } diff --git a/networktest.go b/networktest.go index ac9dc8f9..9f6d8f0d 100644 --- a/networktest.go +++ b/networktest.go @@ -805,6 +805,7 @@ func (n *networkHarness) SetUp() error { expectedBalance := int64(btcutil.SatoshiPerBitcoin * 10) balReq := &lnrpc.WalletBalanceRequest{} balanceTicker := time.Tick(time.Millisecond * 50) + balanceTimeout := time.After(time.Second * 30) out: for { select { @@ -822,7 +823,7 @@ out: bobResp.Balance == expectedBalance { break out } - case <-time.After(time.Second * 30): + case <-balanceTimeout: return fmt.Errorf("balances not synced after deadline") } } @@ -1371,9 +1372,11 @@ func (n *networkHarness) SendCoins(ctx context.Context, amt btcutil.Amount, // Pause until the nodes current wallet balances reflects the amount // sent to it above. // TODO(roasbeef): factor out into helper func + balanceTicker := time.Tick(time.Millisecond * 50) + balanceTimeout := time.After(time.Second * 30) for { select { - case <-time.Tick(time.Millisecond * 50): + case <-balanceTicker: currentBal, err := target.WalletBalance(ctx, balReq) if err != nil { return err @@ -1382,7 +1385,7 @@ func (n *networkHarness) SendCoins(ctx context.Context, amt btcutil.Amount, if currentBal.Balance == initialBalance.Balance+int64(amt) { return nil } - case <-time.After(time.Second * 30): + case <-balanceTimeout: return fmt.Errorf("balances not synced after deadline") } }