diff --git a/lntest/harness.go b/lntest/harness.go index 2b8761163..bf8dd4506 100644 --- a/lntest/harness.go +++ b/lntest/harness.go @@ -223,9 +223,9 @@ func (n *NetworkHarness) SetUp(testCase string, lndArgs []string) error { // Now block until both wallets have fully synced up. expectedBalance := int64(btcutil.SatoshiPerBitcoin * 10) balReq := &lnrpc.WalletBalanceRequest{} - balanceTicker := time.NewTicker(time.Millisecond * 50) + balanceTicker := time.NewTicker(time.Millisecond * 200) defer balanceTicker.Stop() - balanceTimeout := time.After(time.Second * 30) + balanceTimeout := time.After(DefaultTimeout) out: for { select { @@ -290,7 +290,6 @@ func (n *NetworkHarness) NewNodeWithSeed(name string, extraArgs []string, return nil, nil, nil, err } - timeout := time.Duration(time.Second * 15) ctxb := context.Background() // Create a request to generate a new aezeed. The new seed will have the @@ -299,7 +298,8 @@ func (n *NetworkHarness) NewNodeWithSeed(name string, extraArgs []string, AezeedPassphrase: password, } - ctxt, _ := context.WithTimeout(ctxb, timeout) + ctxt, cancel := context.WithTimeout(ctxb, DefaultTimeout) + defer cancel() genSeedResp, err := node.GenSeed(ctxt, genSeedReq) if err != nil { return nil, nil, nil, err @@ -424,7 +424,7 @@ func (n *NetworkHarness) RegisterNode(node *HarnessNode) { func (n *NetworkHarness) connect(ctx context.Context, req *lnrpc.ConnectPeerRequest, a *HarnessNode) error { - syncTimeout := time.After(15 * time.Second) + syncTimeout := time.After(DefaultTimeout) tryconnect: if _, err := a.ConnectPeer(ctx, req); err != nil { // If the chain backend is still syncing, retry. @@ -457,7 +457,8 @@ func (n *NetworkHarness) EnsureConnected(ctx context.Context, a, b *HarnessNode) errConnectionRequested := errors.New("connection request in progress") tryConnect := func(a, b *HarnessNode) error { - ctxt, _ := context.WithTimeout(ctx, 15*time.Second) + ctxt, cancel := context.WithTimeout(ctx, DefaultTimeout) + defer cancel() bInfo, err := b.GetInfo(ctxt, &lnrpc.GetInfoRequest{}) if err != nil { return err @@ -472,7 +473,7 @@ func (n *NetworkHarness) EnsureConnected(ctx context.Context, a, b *HarnessNode) var predErr error err = wait.Predicate(func() bool { - ctx, cancel := context.WithTimeout(ctx, 15*time.Second) + ctx, cancel := context.WithTimeout(ctx, DefaultTimeout) defer cancel() err := n.connect(ctx, req, a) @@ -530,7 +531,8 @@ func (n *NetworkHarness) EnsureConnected(ctx context.Context, a, b *HarnessNode) // If node B is seen in the ListPeers response from node A, // then we can exit early as the connection has been fully // established. - ctxt, _ := context.WithTimeout(ctx, 15*time.Second) + ctxt, cancel := context.WithTimeout(ctx, DefaultTimeout) + defer cancel() resp, err := b.ListPeers(ctxt, &lnrpc.ListPeersRequest{}) if err != nil { return false @@ -547,7 +549,7 @@ func (n *NetworkHarness) EnsureConnected(ctx context.Context, a, b *HarnessNode) err := wait.Predicate(func() bool { return findSelfInPeerList(a, b) && findSelfInPeerList(b, a) - }, time.Second*15) + }, DefaultTimeout) if err != nil { return fmt.Errorf("peers not connected within 15 seconds") } @@ -594,7 +596,7 @@ func (n *NetworkHarness) ConnectNodes(ctx context.Context, a, b *HarnessNode) er } return false - }, time.Second*15) + }, DefaultTimeout) if err != nil { return fmt.Errorf("peers not connected within 15 seconds") } @@ -1038,7 +1040,7 @@ func (n *NetworkHarness) CloseChannel(ctx context.Context, // We'll wait for *both* nodes to read the channel as active if we're // performing a cooperative channel closure. if !force { - timeout := time.Second * 15 + timeout := DefaultTimeout listReq := &lnrpc.ListChannelsRequest{} // We define two helper functions, one two locate a particular @@ -1223,7 +1225,7 @@ func (n *NetworkHarness) AssertChannelExists(ctx context.Context, } return fmt.Errorf("channel %s not found", chanPoint) - }, 15*time.Second) + }, DefaultTimeout) } // DumpLogs reads the current logs generated by the passed node, and returns @@ -1355,7 +1357,7 @@ func (n *NetworkHarness) sendCoins(ctx context.Context, amt btcutil.Amount, } return nil - }, 15*time.Second) + }, DefaultTimeout) if err != nil { return fmt.Errorf("unconfirmed utxo was not found in "+ "ListUnspent: %v", err) diff --git a/lntest/itest/lnd_channel_backup_test.go b/lntest/itest/lnd_channel_backup_test.go index e6b57a73b..5b6f2fcdb 100644 --- a/lntest/itest/lnd_channel_backup_test.go +++ b/lntest/itest/lnd_channel_backup_test.go @@ -520,7 +520,7 @@ func testChannelBackupUpdates(net *lntest.NetworkHarness, t *harnessTest) { } return nil - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("backup state invalid: %v", err) } @@ -987,6 +987,33 @@ func testChanRestoreScenario(t *harnessTest, net *lntest.NetworkHarness, ) require.NoError(t.t, err) + // We now need to make sure the server is fully started before we can + // actually close the channel. This is the first check in CloseChannel + // so we can try with a nil channel point until we get the correct error + // to find out if Dave is fully started. + err = wait.Predicate(func() bool { + const expectedErr = "must specify channel point" + ctxc, cancel := context.WithCancel(ctxt) + defer cancel() + + resp, err := dave.CloseChannel( + ctxc, &lnrpc.CloseChannelRequest{}, + ) + if err != nil { + return false + } + + defer func() { _ = resp.CloseSend() }() + + _, err = resp.Recv() + if err != nil && strings.Contains(err.Error(), expectedErr) { + return true + } + + return false + }, defaultTimeout) + require.NoError(t.t, err) + // We also want to make sure we cannot force close in this state. That // would get the state machine in a weird state. chanPointParts := strings.Split( diff --git a/lntest/itest/lnd_multi-hop_test.go b/lntest/itest/lnd_multi-hop_test.go index 3707ae111..a70863106 100644 --- a/lntest/itest/lnd_multi-hop_test.go +++ b/lntest/itest/lnd_multi-hop_test.go @@ -272,7 +272,7 @@ func createThreeHopNetwork(t *harnessTest, net *lntest.NetworkHarness, ctxt, _ = context.WithTimeout(context.Background(), defaultTimeout) err = net.SendCoins(ctxt, btcutil.SatoshiPerBitcoin, carol) if err != nil { - t.Fatalf("unable to send coins to Alice: %v", err) + t.Fatalf("unable to send coins to Carol: %v", err) } } diff --git a/lntest/itest/lnd_test.go b/lntest/itest/lnd_test.go index 04c5a10e4..68845c9f3 100644 --- a/lntest/itest/lnd_test.go +++ b/lntest/itest/lnd_test.go @@ -373,7 +373,7 @@ func assertChannelClosed(ctx context.Context, t *harnessTest, } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("closing transaction not marked as fully closed") } @@ -532,7 +532,7 @@ func assertNumOpenChannelsPending(ctxt context.Context, t *harnessTest, } return nil - }, 15*time.Second) + }, defaultTimeout) if err != nil { t.Fatalf(err.Error()) } @@ -703,7 +703,7 @@ func completePaymentRequests(ctx context.Context, client lnrpc.LightningClient, } return false - }, time.Second*15) + }, defaultTimeout) if err != nil { return err } @@ -848,7 +848,7 @@ func testGetRecoveryInfo(net *lntest.NetworkHarness, t *harnessTest) { } return true - }, 15*time.Second) + }, defaultTimeout) if err != nil { t.Fatalf("expected recovery mode to be %v, got %v, "+ "expected recovery finished to be %v, got %v, "+ @@ -952,7 +952,7 @@ func testOnchainFundRecovery(net *lntest.NetworkHarness, t *harnessTest) { } return true - }, 15*time.Second) + }, defaultTimeout) if err != nil { t.Fatalf("expected restored node to have %d satoshis, "+ "instead has %d satoshis, expected %d utxos "+ @@ -1805,7 +1805,7 @@ out: } case err := <-subscription.errChan: t.Fatalf("unable to recv graph update: %v", err) - case <-time.After(20 * time.Second): + case <-time.After(defaultTimeout): t.Fatalf("did not receive channel update") } } @@ -2396,7 +2396,7 @@ func waitForNodeBlockHeight(ctx context.Context, node *lntest.HarnessNode, height int32) error { var predErr error err := wait.Predicate(func() bool { - ctxt, _ := context.WithTimeout(ctx, 10*time.Second) + ctxt, _ := context.WithTimeout(ctx, defaultTimeout) info, err := node.GetInfo(ctxt, &lnrpc.GetInfoRequest{}) if err != nil { predErr = err @@ -2409,7 +2409,7 @@ func waitForNodeBlockHeight(ctx context.Context, node *lntest.HarnessNode, return false } return true - }, 15*time.Second) + }, defaultTimeout) if err != nil { return predErr } @@ -2445,7 +2445,7 @@ func assertMinerBlockHeightDelta(t *harnessTest, return false } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf(predErr.Error()) } @@ -2680,7 +2680,7 @@ func testOpenChannelAfterReorg(net *lntest.NetworkHarness, t *harnessTest) { return false } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf(predErr.Error()) } @@ -3619,7 +3619,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest, return false } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("htlc mismatch: %v", predErr) } @@ -3821,7 +3821,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest, } return nil - }, 15*time.Second) + }, defaultTimeout) if err != nil { t.Fatalf(predErr.Error()) } @@ -3936,7 +3936,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest, } return nil - }, 15*time.Second) + }, defaultTimeout) if err != nil { t.Fatalf(err.Error()) } @@ -4069,7 +4069,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest, } return true - }, 15*time.Second) + }, defaultTimeout) if err != nil { t.Fatalf(predErr.Error()) } @@ -4143,7 +4143,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest, } return nil - }, 15*time.Second) + }, defaultTimeout) if err != nil { t.Fatalf(err.Error()) } @@ -4307,7 +4307,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest, } return true - }, 15*time.Second) + }, defaultTimeout) if err != nil { t.Fatalf(predErr.Error()) } @@ -4437,7 +4437,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest, } return true - }, 15*time.Second) + }, defaultTimeout) if err != nil { t.Fatalf(predErr.Error()) } @@ -4475,7 +4475,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest, } return true - }, 15*time.Second) + }, defaultTimeout) if err != nil { t.Fatalf(predErr.Error()) } @@ -5299,7 +5299,7 @@ func assertAmountPaid(t *harnessTest, channelName string, // are in place var timeover uint32 go func() { - <-time.After(time.Second * 20) + <-time.After(defaultTimeout) atomic.StoreUint32(&timeover, 1) }() @@ -6182,7 +6182,7 @@ func testUnannouncedChannels(net *lntest.NetworkHarness, t *harnessTest) { return false } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("%v", predErr) } @@ -6534,7 +6534,7 @@ func testPrivateChannels(net *lntest.NetworkHarness, t *harnessTest) { return false } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("%v", predErr) } @@ -6716,7 +6716,7 @@ func testInvoiceRoutingHints(net *lntest.NetworkHarness, t *harnessTest) { return false } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf(predErr.Error()) } @@ -7749,7 +7749,7 @@ func testFailingChannel(net *lntest.NetworkHarness, t *harnessTest) { return false } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("%v", predErr) } @@ -7785,7 +7785,7 @@ func testFailingChannel(net *lntest.NetworkHarness, t *harnessTest) { return false } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("%v", predErr) } @@ -7807,7 +7807,7 @@ func testFailingChannel(net *lntest.NetworkHarness, t *harnessTest) { return false } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("%v", predErr) } @@ -7855,7 +7855,7 @@ func testFailingChannel(net *lntest.NetworkHarness, t *harnessTest) { return false } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("%v", predErr) } @@ -7948,18 +7948,12 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) { t.Fatalf("unable to restart carol's node: %v", err) } - err = wait.Predicate(func() bool { + require.Eventually(t.t, func() bool { return isConnected(net.Bob.PubKeyStr) - }, 15*time.Second) - if err != nil { - t.Fatalf("alice did not reconnect to bob") - } - err = wait.Predicate(func() bool { + }, defaultTimeout, 20*time.Millisecond) + require.Eventually(t.t, func() bool { return isConnected(carol.PubKeyStr) - }, 15*time.Second) - if err != nil { - t.Fatalf("alice did not reconnect to carol") - } + }, defaultTimeout, 20*time.Millisecond) // We'll also restart Alice to ensure she can reconnect to her peers // with open channels. @@ -7967,24 +7961,18 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) { t.Fatalf("unable to restart alice's node: %v", err) } - err = wait.Predicate(func() bool { + require.Eventually(t.t, func() bool { return isConnected(net.Bob.PubKeyStr) - }, 15*time.Second) - if err != nil { - t.Fatalf("alice did not reconnect to bob") - } - err = wait.Predicate(func() bool { + }, defaultTimeout, 20*time.Millisecond) + require.Eventually(t.t, func() bool { return isConnected(carol.PubKeyStr) - }, 15*time.Second) - if err != nil { - t.Fatalf("alice did not reconnect to carol") - } + }, defaultTimeout, 20*time.Millisecond) + require.Eventually(t.t, func() bool { + return isConnected(dave.PubKeyStr) + }, defaultTimeout, 20*time.Millisecond) err = wait.Predicate(func() bool { return isConnected(dave.PubKeyStr) - }, 15*time.Second) - if err != nil { - t.Fatalf("alice did not reconnect to dave") - } + }, defaultTimeout) // testReconnection is a helper closure that restarts the nodes at both // ends of a channel to ensure they do not reconnect after restarting. @@ -8019,7 +8007,7 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) { } err = wait.Predicate(func() bool { return isConnected(dave.PubKeyStr) - }, 20*time.Second) + }, defaultTimeout) if err != nil { t.Fatalf("alice didn't reconnect to Dave") } @@ -8091,7 +8079,7 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) { } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("channels not marked as fully resolved: %v", predErr) } @@ -8223,7 +8211,7 @@ func testRevokedCloseRetribution(net *lntest.NetworkHarness, t *harnessTest) { bobChan = bChan return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("%v", predErr) } @@ -8301,7 +8289,7 @@ func testRevokedCloseRetribution(net *lntest.NetworkHarness, t *harnessTest) { } return true - }, time.Second*10) + }, defaultTimeout) if err != nil { t.Fatalf("unable to close channel: %v", predErr) } @@ -8555,7 +8543,7 @@ func testRevokedCloseRetributionZeroValueRemoteOutput(net *lntest.NetworkHarness ctxt, carol, chanPoint, force, ) return closeErr == nil - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("unable to close channel: %v", closeErr) } @@ -8966,7 +8954,7 @@ func testRevokedCloseRetributionRemoteHodl(net *lntest.NetworkHarness, justiceTxid = txid return true - }, time.Second*10) + }, defaultTimeout) if err != nil && predErr == errNotFound { // If Dave is unable to broadcast his justice tx on first // attempt because of the second layer transactions, he will @@ -8986,7 +8974,7 @@ func testRevokedCloseRetributionRemoteHodl(net *lntest.NetworkHarness, justiceTxid = txid return true - }, time.Second*10) + }, defaultTimeout) } if err != nil { t.Fatalf(predErr.Error()) @@ -9480,7 +9468,7 @@ func testRevokedCloseRetributionAltruistWatchtowerCase( } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("%v", predErr) } @@ -9504,7 +9492,7 @@ func testRevokedCloseRetributionAltruistWatchtowerCase( } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("%v", predErr) } @@ -9543,7 +9531,7 @@ func assertNumPendingChannels(t *harnessTest, node *lntest.HarnessNode, return false } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("%v", predErr) } @@ -9798,7 +9786,7 @@ func testDataLossProtection(net *lntest.NetworkHarness, t *harnessTest) { nodeChan = bChan return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("%v", predErr) } @@ -10001,7 +9989,7 @@ func testDataLossProtection(net *lntest.NetworkHarness, t *harnessTest) { } return nil - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("%v", err) } @@ -10037,7 +10025,7 @@ func assertNodeNumChannels(t *harnessTest, node *lntest.HarnessNode, return true } - if err := wait.Predicate(pred, time.Second*15); err != nil { + if err := wait.Predicate(pred, defaultTimeout); err != nil { t.Fatalf("node has incorrect number of channels: %v", predErr) } } @@ -10583,7 +10571,7 @@ func testNodeAnnouncement(net *lntest.NetworkHarness, t *harnessTest) { } case err := <-graphSub.errChan: t.Fatalf("unable to recv graph update: %v", err) - case <-time.After(20 * time.Second): + case <-time.After(defaultTimeout): t.Fatalf("did not receive node ann update") } } @@ -11338,7 +11326,7 @@ func testSwitchCircuitPersistence(net *lntest.NetworkHarness, t *harnessTest) { return false } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("htlc mismatch: %v", predErr) } @@ -11373,7 +11361,7 @@ func testSwitchCircuitPersistence(net *lntest.NetworkHarness, t *harnessTest) { err = wait.Predicate(func() bool { predErr = assertNumActiveHtlcs(nodes, numPayments) return predErr == nil - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("htlc mismatch: %v", predErr) } @@ -11397,7 +11385,7 @@ func testSwitchCircuitPersistence(net *lntest.NetworkHarness, t *harnessTest) { predErr = assertNumActiveHtlcs(nodes, 0) return predErr == nil - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("htlc mismatch: %v", predErr) } @@ -11655,7 +11643,7 @@ func testSwitchOfflineDelivery(net *lntest.NetworkHarness, t *harnessTest) { err = wait.Predicate(func() bool { predErr = assertNumActiveHtlcs(nodes, numPayments) return predErr == nil - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("htlc mismatch: %v", predErr) } @@ -11678,7 +11666,7 @@ func testSwitchOfflineDelivery(net *lntest.NetworkHarness, t *harnessTest) { err = wait.Invariant(func() bool { predErr = assertNumActiveHtlcs(nodes, numPayments) return predErr == nil - }, time.Second*2) + }, defaultTimeout) if err != nil { t.Fatalf("htlc change: %v", predErr) } @@ -11702,7 +11690,7 @@ func testSwitchOfflineDelivery(net *lntest.NetworkHarness, t *harnessTest) { err = wait.Predicate(func() bool { predErr = assertNumActiveHtlcs(carolNode, 0) return predErr == nil - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("htlc mismatch: %v", predErr) } @@ -11721,7 +11709,7 @@ func testSwitchOfflineDelivery(net *lntest.NetworkHarness, t *harnessTest) { return false } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("htlc mismatch: %v", predErr) } @@ -11982,7 +11970,7 @@ func testSwitchOfflineDeliveryPersistence(net *lntest.NetworkHarness, t *harness } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("htlc mismatch: %v", predErr) } @@ -12019,7 +12007,7 @@ func testSwitchOfflineDeliveryPersistence(net *lntest.NetworkHarness, t *harness predErr = assertNumActiveHtlcsChanPoint(dave, carolFundPoint, 0) return predErr == nil - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("htlc mismatch: %v", predErr) } @@ -12049,7 +12037,7 @@ func testSwitchOfflineDeliveryPersistence(net *lntest.NetworkHarness, t *harness return false } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("htlc mismatch: %v", predErr) } @@ -12316,7 +12304,7 @@ func testSwitchOfflineDeliveryOutgoingOffline( return false } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("htlc mismatch: %v", predErr) } @@ -12344,7 +12332,7 @@ func testSwitchOfflineDeliveryOutgoingOffline( predErr = assertNumActiveHtlcsChanPoint(dave, carolFundPoint, 0) return predErr == nil - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("htlc mismatch: %v", predErr) } @@ -12389,7 +12377,7 @@ func testSwitchOfflineDeliveryOutgoingOffline( return false } return true - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("htlc mismatch: %v", predErr) } @@ -13723,7 +13711,7 @@ func testHoldInvoicePersistence(net *lntest.NetworkHarness, t *harnessTest) { } return nil - }, time.Second*15) + }, defaultTimeout) if err != nil { t.Fatalf("predicate not satisfied: %v", err) } diff --git a/lntest/node.go b/lntest/node.go index 473bde2ca..73b44acd2 100644 --- a/lntest/node.go +++ b/lntest/node.go @@ -660,7 +660,7 @@ func (hn *HarnessNode) initClientWhenReady() error { if err := wait.NoError(func() error { conn, connErr = hn.ConnectRPC(true) return connErr - }, 5*time.Second); err != nil { + }, DefaultTimeout); err != nil { return err } @@ -1005,7 +1005,7 @@ func (hn *HarnessNode) stop() error { // Wait for lnd process and other goroutines to exit. select { case <-hn.processExit: - case <-time.After(60 * time.Second): + case <-time.After(DefaultTimeout * 2): return fmt.Errorf("process did not exit") } @@ -1357,7 +1357,7 @@ func (hn *HarnessNode) WaitForBalance(expectedBalance btcutil.Amount, confirmed return btcutil.Amount(balance.UnconfirmedBalance) == expectedBalance } - err := wait.Predicate(doesBalanceMatch, 30*time.Second) + err := wait.Predicate(doesBalanceMatch, DefaultTimeout) if err != nil { return fmt.Errorf("balances not synced after deadline: "+ "expected %v, only have %v", expectedBalance, lastBalance) diff --git a/lntest/wait/wait.go b/lntest/wait/wait.go index 88cdb27d5..a2981816d 100644 --- a/lntest/wait/wait.go +++ b/lntest/wait/wait.go @@ -11,7 +11,7 @@ import ( // several running lnd nodes. This function gives callers a way to assert that // some property is upheld within a particular time frame. func Predicate(pred func() bool, timeout time.Duration) error { - const pollInterval = 20 * time.Millisecond + const pollInterval = 200 * time.Millisecond exitTimer := time.After(timeout) for { diff --git a/make/testing_flags.mk b/make/testing_flags.mk index f8293c1c3..da5cbeb11 100644 --- a/make/testing_flags.mk +++ b/make/testing_flags.mk @@ -5,7 +5,7 @@ TEST_FLAGS = ITEST_FLAGS = EXEC_SUFFIX = COVER_PKG = $$(go list -deps ./... | grep '$(PKG)' | grep -v lnrpc) -NUM_ITEST_TRANCHES = 6 +NUM_ITEST_TRANCHES = 4 ITEST_PARALLELISM = $(NUM_ITEST_TRANCHES) # If rpc option is set also add all extra RPC tags to DEV_TAGS