mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-04-12 05:59:06 +02:00
itest+lntest: add a dedicated timeout for sending payments
This commit adds a new timeout `PaymentTimeout` that's used when sending payments. A potential bug is also marked in the test.
This commit is contained in:
parent
ae6e109f35
commit
d5af76cb29
@ -714,6 +714,19 @@ func testUpdateChannelPolicyForPrivateChannel(ht *lntest.HarnessTest) {
|
||||
|
||||
// Alice pays the invoices. She will use the updated baseFeeMSat in the
|
||||
// payment
|
||||
//
|
||||
// TODO(yy): we may get a flake saying the timeout checking the
|
||||
// payment's state, which is due to slow round of HTLC settlement. An
|
||||
// example log is shown below, where Alice sent RevokeAndAck to Bob,
|
||||
// but it took Bob 7 seconds to reply back the final UpdateFulfillHTLC.
|
||||
//
|
||||
// 2022-11-14 06:23:59.774 PEER: Peer(Bob): Sending UpdateAddHTLC
|
||||
// 2022-11-14 06:24:00.635 PEER: Peer(Bob): Sending CommitSig
|
||||
// 2022-11-14 06:24:01.784 PEER: Peer(Bob): Sending RevokeAndAck
|
||||
// 2022-11-14 06:24:08.464 PEER: Peer(Bob): Received UpdateFulfillHTLC
|
||||
//
|
||||
// 7 seconds is too long for a local test and this needs more
|
||||
// investigation.
|
||||
payReqs := []string{resp.PaymentRequest}
|
||||
ht.CompletePaymentRequests(alice, payReqs)
|
||||
|
||||
|
@ -1294,7 +1294,7 @@ func (h *HarnessTest) completePaymentRequestsAssertStatus(hn *node.HarnessNode,
|
||||
send := func(payReq string) {
|
||||
req := &routerrpc.SendPaymentRequest{
|
||||
PaymentRequest: payReq,
|
||||
TimeoutSeconds: defaultPaymentTimeout,
|
||||
TimeoutSeconds: int32(wait.PaymentTimeout.Seconds()),
|
||||
FeeLimitMsat: noFeeLimitMsat,
|
||||
}
|
||||
stream := hn.RPC.SendPayment(req)
|
||||
@ -1310,7 +1310,7 @@ func (h *HarnessTest) completePaymentRequestsAssertStatus(hn *node.HarnessNode,
|
||||
}
|
||||
|
||||
// Wait for all payments to report the expected status.
|
||||
timer := time.After(DefaultTimeout)
|
||||
timer := time.After(wait.PaymentTimeout)
|
||||
select {
|
||||
case stream := <-results:
|
||||
h.AssertPaymentStatusFromStream(stream, status)
|
||||
|
@ -948,7 +948,9 @@ func (h *HarnessTest) AssertNodesNumPendingOpenChannels(a, b *node.HarnessNode,
|
||||
func (h *HarnessTest) AssertPaymentStatusFromStream(stream rpc.PaymentClient,
|
||||
status lnrpc.Payment_PaymentStatus) *lnrpc.Payment {
|
||||
|
||||
return h.assertPaymentStatusWithTimeout(stream, status, DefaultTimeout)
|
||||
return h.assertPaymentStatusWithTimeout(
|
||||
stream, status, wait.PaymentTimeout,
|
||||
)
|
||||
}
|
||||
|
||||
// AssertPaymentSucceedWithTimeout asserts that a payment is succeeded within
|
||||
|
@ -27,10 +27,6 @@ const (
|
||||
// noFeeLimitMsat is used to specify we will put no requirements on fee
|
||||
// charged when choosing a route path.
|
||||
noFeeLimitMsat = math.MaxInt64
|
||||
|
||||
// defaultPaymentTimeout specifies the default timeout in seconds when
|
||||
// sending a payment.
|
||||
defaultPaymentTimeout = 60
|
||||
)
|
||||
|
||||
// CopyFile copies the file src to dest.
|
||||
|
@ -33,4 +33,7 @@ const (
|
||||
// SqliteBusyTimeout is the maximum time that a call to the sqlite db
|
||||
// will wait for the connection to become available.
|
||||
SqliteBusyTimeout = time.Second * 10
|
||||
|
||||
// PaymentTimeout is the timeout used when sending payments.
|
||||
PaymentTimeout = time.Second * 60
|
||||
)
|
||||
|
@ -34,4 +34,7 @@ const (
|
||||
// SqliteBusyTimeout is the maximum time that a call to the sqlite db
|
||||
// will wait for the connection to become available.
|
||||
SqliteBusyTimeout = time.Second * 10
|
||||
|
||||
// PaymentTimeout is the timeout used when sending payments.
|
||||
PaymentTimeout = time.Second * 60
|
||||
)
|
||||
|
@ -33,4 +33,7 @@ const (
|
||||
// SqliteBusyTimeout is the maximum time that a call to the sqlite db
|
||||
// will wait for the connection to become available.
|
||||
SqliteBusyTimeout = time.Second * 10
|
||||
|
||||
// PaymentTimeout is the timeout used when sending payments.
|
||||
PaymentTimeout = time.Second * 60
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user