mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-05-04 17:00:20 +02:00
itest: fix flake in testOptionScidUpgrade
This commit is contained in:
parent
4fdce8b448
commit
52dff48477
@ -1,6 +1,7 @@
|
|||||||
package itest
|
package itest
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -821,25 +822,34 @@ func testOptionScidUpgrade(ht *lntest.HarnessTest) {
|
|||||||
var startingAlias lnwire.ShortChannelID
|
var startingAlias lnwire.ShortChannelID
|
||||||
startingAlias.BlockHeight = 16_000_000
|
startingAlias.BlockHeight = 16_000_000
|
||||||
|
|
||||||
err := wait.Predicate(func() bool {
|
// TODO(yy): Carol and Dave will attempt to connect to each other
|
||||||
|
// during restart. However, due to the race condition in peer
|
||||||
|
// connection, they may both fail. Thus we need to ensure the
|
||||||
|
// connection here. Once the race is fixed, we can remove this line.
|
||||||
|
ht.EnsureConnected(dave, carol)
|
||||||
|
|
||||||
|
err := wait.NoError(func() error {
|
||||||
invoiceResp := dave.RPC.AddInvoice(daveParams)
|
invoiceResp := dave.RPC.AddInvoice(daveParams)
|
||||||
decodedReq := dave.RPC.DecodePayReq(invoiceResp.PaymentRequest)
|
decodedReq := dave.RPC.DecodePayReq(invoiceResp.PaymentRequest)
|
||||||
|
|
||||||
if len(decodedReq.RouteHints) != 1 {
|
if len(decodedReq.RouteHints) != 1 {
|
||||||
return false
|
return fmt.Errorf("expected 1 route hint, got %v",
|
||||||
|
decodedReq.RouteHints)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(decodedReq.RouteHints[0].HopHints) != 1 {
|
if len(decodedReq.RouteHints[0].HopHints) != 1 {
|
||||||
return false
|
return fmt.Errorf("expected 1 hop hint, got %v",
|
||||||
|
len(decodedReq.RouteHints[0].HopHints))
|
||||||
}
|
}
|
||||||
|
|
||||||
hopHint := decodedReq.RouteHints[0].HopHints[0].ChanId
|
hopHint := decodedReq.RouteHints[0].HopHints[0].ChanId
|
||||||
if startingAlias.ToUint64() == hopHint {
|
if startingAlias.ToUint64() == hopHint {
|
||||||
daveInvoice = invoiceResp
|
daveInvoice = invoiceResp
|
||||||
return true
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return fmt.Errorf("unmatched alias, expected %v, got %v",
|
||||||
|
startingAlias.ToUint64(), hopHint)
|
||||||
}, defaultTimeout)
|
}, defaultTimeout)
|
||||||
require.NoError(ht, err)
|
require.NoError(ht, err)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user