Merge pull request #9228 from yyforyongyu/fix-itest-flakes
itest: fix flake in `payment_failure_reason_canceled`
This commit is contained in:
2 files changed
+8
-10
No files matched your search
@@ -1113,12 +1113,16 @@ func testPaymentFailureReasonCanceled(ht *lntest.HarnessTest) {
|
|||||||
// Make sure Alice is aware of channel Bob=>Carol.
|
// Make sure Alice is aware of channel Bob=>Carol.
|
||||||
ht.AssertTopologyChannelOpen(alice, cpBC)
|
ht.AssertTopologyChannelOpen(alice, cpBC)
|
||||||
|
|
||||||
|
// Connect the interceptor.
|
||||||
|
interceptor, cancelInterceptor := bob.RPC.HtlcInterceptor()
|
||||||
|
defer cancelInterceptor()
|
||||||
|
|
||||||
// First we check that the payment is successful when bob resumes the
|
// First we check that the payment is successful when bob resumes the
|
||||||
// htlc even though the payment context was canceled before invoice
|
// htlc even though the payment context was canceled before invoice
|
||||||
// settlement.
|
// settlement.
|
||||||
sendPaymentInterceptAndCancel(
|
sendPaymentInterceptAndCancel(
|
||||||
ht, ts, cpAB, routerrpc.ResolveHoldForwardAction_RESUME,
|
ht, ts, cpAB, routerrpc.ResolveHoldForwardAction_RESUME,
|
||||||
lnrpc.Payment_SUCCEEDED,
|
lnrpc.Payment_SUCCEEDED, interceptor,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Next we check that the context cancellation results in the expected
|
// Next we check that the context cancellation results in the expected
|
||||||
@@ -1128,7 +1132,7 @@ func testPaymentFailureReasonCanceled(ht *lntest.HarnessTest) {
|
|||||||
// htlc fail case before the htlc resume case.
|
// htlc fail case before the htlc resume case.
|
||||||
sendPaymentInterceptAndCancel(
|
sendPaymentInterceptAndCancel(
|
||||||
ht, ts, cpAB, routerrpc.ResolveHoldForwardAction_FAIL,
|
ht, ts, cpAB, routerrpc.ResolveHoldForwardAction_FAIL,
|
||||||
lnrpc.Payment_FAILED,
|
lnrpc.Payment_FAILED, interceptor,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Finally, close channels.
|
// Finally, close channels.
|
||||||
@@ -1139,14 +1143,12 @@ func testPaymentFailureReasonCanceled(ht *lntest.HarnessTest) {
|
|||||||
func sendPaymentInterceptAndCancel(ht *lntest.HarnessTest,
|
func sendPaymentInterceptAndCancel(ht *lntest.HarnessTest,
|
||||||
ts *interceptorTestScenario, cpAB *lnrpc.ChannelPoint,
|
ts *interceptorTestScenario, cpAB *lnrpc.ChannelPoint,
|
||||||
interceptorAction routerrpc.ResolveHoldForwardAction,
|
interceptorAction routerrpc.ResolveHoldForwardAction,
|
||||||
expectedPaymentStatus lnrpc.Payment_PaymentStatus) {
|
expectedPaymentStatus lnrpc.Payment_PaymentStatus,
|
||||||
|
interceptor rpc.InterceptorClient) {
|
||||||
|
|
||||||
// Prepare the test cases.
|
// Prepare the test cases.
|
||||||
alice, bob, carol := ts.alice, ts.bob, ts.carol
|
alice, bob, carol := ts.alice, ts.bob, ts.carol
|
||||||
|
|
||||||
// Connect the interceptor.
|
|
||||||
interceptor, cancelInterceptor := bob.RPC.HtlcInterceptor()
|
|
||||||
|
|
||||||
// Prepare the test cases.
|
// Prepare the test cases.
|
||||||
addResponse := carol.RPC.AddInvoice(&lnrpc.Invoice{
|
addResponse := carol.RPC.AddInvoice(&lnrpc.Invoice{
|
||||||
ValueMsat: 1000,
|
ValueMsat: 1000,
|
||||||
@@ -1208,9 +1210,6 @@ func sendPaymentInterceptAndCancel(ht *lntest.HarnessTest,
|
|||||||
// should've been made, and we observe FAILURE_REASON_CANCELED.
|
// should've been made, and we observe FAILURE_REASON_CANCELED.
|
||||||
expectedReason := lnrpc.PaymentFailureReason_FAILURE_REASON_CANCELED
|
expectedReason := lnrpc.PaymentFailureReason_FAILURE_REASON_CANCELED
|
||||||
ht.AssertPaymentFailureReason(alice, preimage, expectedReason)
|
ht.AssertPaymentFailureReason(alice, preimage, expectedReason)
|
||||||
|
|
||||||
// Cancel the context, which will disconnect the above interceptor.
|
|
||||||
cancelInterceptor()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// testSendToRouteFailHTLCTimeout is similar to
|
// testSendToRouteFailHTLCTimeout is similar to
|
||||||
|
|||||||
@@ -342,7 +342,6 @@ func (h *HarnessTest) SetupStandbyNodes() {
|
|||||||
// above a good number of confirmations.
|
// above a good number of confirmations.
|
||||||
const totalTxes = 200
|
const totalTxes = 200
|
||||||
h.MineBlocksAndAssertNumTxes(numBlocksSendOutput, totalTxes)
|
h.MineBlocksAndAssertNumTxes(numBlocksSendOutput, totalTxes)
|
||||||
h.MineBlocks(numBlocksSendOutput)
|
|
||||||
|
|
||||||
// Now we want to wait for the nodes to catch up.
|
// Now we want to wait for the nodes to catch up.
|
||||||
h.WaitForBlockchainSync(h.Alice)
|
h.WaitForBlockchainSync(h.Alice)
|
||||||
|
|||||||
Reference in new issue
Block a user