Skip to content

Commit

Permalink
Merge 3fa7d18 into 80a8cc0
Browse files Browse the repository at this point in the history
  • Loading branch information
aakselrod committed Aug 10, 2017
2 parents 80a8cc0 + 3fa7d18 commit 4b8ed89
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lnd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2954,7 +2954,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)
}
Expand Down
9 changes: 6 additions & 3 deletions networktest.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,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 {
Expand All @@ -821,7 +822,7 @@ out:
bobResp.Balance == expectedBalance {
break out
}
case <-time.After(time.Second * 30):
case <-balanceTimeout:
return fmt.Errorf("balances not synced after deadline")
}
}
Expand Down Expand Up @@ -1370,9 +1371,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
Expand All @@ -1381,7 +1384,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")
}
}
Expand Down

0 comments on commit 4b8ed89

Please sign in to comment.