Merge pull request #1210 from halseth/route-hints-flake

[integration flake] Fix route hints flake
This commit is contained in:
Olaoluwa Osuntokun 2018-05-09 16:33:45 -07:00 committed by GitHub
commit 03a7c027e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3433,23 +3433,27 @@ func testInvoiceRoutingHints(net *lntest.NetworkHarness, t *harnessTest) {
Private: true, Private: true,
} }
resp, err := net.Alice.AddInvoice(ctxb, invoice)
if err != nil {
t.Fatalf("unable to add invoice: %v", err)
}
// We'll decode the invoice's payment request to determine which
// channels were used as routing hints.
payReq := &lnrpc.PayReqString{resp.PaymentRequest}
decoded, err := net.Alice.DecodePayReq(ctxb, payReq)
if err != nil {
t.Fatalf("unable to decode payment request: %v", err)
}
// Due to the way the channels were set up above, the channel between // Due to the way the channels were set up above, the channel between
// Alice and Bob should be the only channel used as a routing hint. // Alice and Bob should be the only channel used as a routing hint.
var predErr error var predErr error
var decoded *lnrpc.PayReq
err = lntest.WaitPredicate(func() bool { err = lntest.WaitPredicate(func() bool {
resp, err := net.Alice.AddInvoice(ctxb, invoice)
if err != nil {
predErr = fmt.Errorf("unable to add invoice: %v", err)
return false
}
// We'll decode the invoice's payment request to determine which
// channels were used as routing hints.
payReq := &lnrpc.PayReqString{resp.PaymentRequest}
decoded, err = net.Alice.DecodePayReq(ctxb, payReq)
if err != nil {
predErr = fmt.Errorf("unable to decode payment "+
"request: %v", err)
return false
}
if len(decoded.RouteHints) != 1 { if len(decoded.RouteHints) != 1 {
predErr = fmt.Errorf("expected one route hint, got %d", predErr = fmt.Errorf("expected one route hint, got %d",
len(decoded.RouteHints)) len(decoded.RouteHints))
@ -6518,7 +6522,7 @@ func testMultiHopReceiverChainClaim(net *lntest.NetworkHarness, t *harnessTest)
return true return true
}, time.Second*15) }, time.Second*15)
if err != nil { if err != nil {
t.Fatalf("htlc mismatch: %v", err) t.Fatalf("htlc mismatch: %v", predErr)
} }
// Now we'll mine enough blocks to prompt carol to actually go to the // Now we'll mine enough blocks to prompt carol to actually go to the