Merge pull request #4716 from matheusdtech/fix-itest-comment

itest: Sync nodes to chain during singleHop tests
This commit is contained in:
Oliver Gugger 2020-10-27 09:36:46 +00:00 committed by GitHub
commit 747bd674dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -5381,14 +5381,23 @@ func testSingleHopSendToRouteCase(net *lntest.NetworkHarness, t *harnessTest,
payAddrs = append(payAddrs, resp.PaymentAddr) payAddrs = append(payAddrs, resp.PaymentAddr)
} }
// Query for routes to pay from Carol to Dave. // Assert Carol and Dave are synced to the chain before proceeding, to
// We set FinalCltvDelta to 40 since by default QueryRoutes returns // ensure the queried route will have a valid final CLTV once the HTLC
// the last hop with a final cltv delta of 9 where as the default in // reaches Dave.
// htlcswitch is 40. _, minerHeight, err := net.Miner.Node.GetBestBlock()
if err != nil {
t.Fatalf("unable to get best height: %v", err)
}
ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout)
defer cancel()
require.NoError(t.t, waitForNodeBlockHeight(ctxt, carol, minerHeight))
require.NoError(t.t, waitForNodeBlockHeight(ctxt, dave, minerHeight))
// Query for routes to pay from Carol to Dave using the default CLTV
// config.
routesReq := &lnrpc.QueryRoutesRequest{ routesReq := &lnrpc.QueryRoutesRequest{
PubKey: dave.PubKeyStr, PubKey: dave.PubKeyStr,
Amt: paymentAmtSat, Amt: paymentAmtSat,
FinalCltvDelta: lnd.DefaultBitcoinTimeLockDelta,
} }
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout) ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
routes, err := carol.QueryRoutes(ctxt, routesReq) routes, err := carol.QueryRoutes(ctxt, routesReq)