itest: assert payment status after sending

This commit is contained in:
yyforyongyu 2024-10-25 03:03:06 +08:00
parent 425877e745
commit 36a87ad5f4
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868
8 changed files with 32 additions and 35 deletions

View File

@ -156,7 +156,7 @@ func testChannelUnsettledBalance(ht *lntest.HarnessTest) {
TimeoutSeconds: 60, TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
} }
alice.RPC.SendPayment(req) ht.SendPaymentAssertInflight(alice, req)
}() }()
} }

View File

@ -114,7 +114,7 @@ func runChannelForceClosureTest(ht *lntest.HarnessTest,
TimeoutSeconds: 60, TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
} }
alice.RPC.SendPayment(req) ht.SendPaymentAssertInflight(alice, req)
} }
// Once the HTLC has cleared, all the nodes n our mini network should // Once the HTLC has cleared, all the nodes n our mini network should

View File

@ -508,8 +508,7 @@ func testForwardInterceptorWireRecords(ht *lntest.HarnessTest) {
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
FirstHopCustomRecords: customRecords, FirstHopCustomRecords: customRecords,
} }
ht.SendPaymentAssertInflight(alice, sendReq)
_ = alice.RPC.SendPayment(sendReq)
// We start the htlc interceptor with a simple implementation that saves // We start the htlc interceptor with a simple implementation that saves
// all intercepted packets. These packets are held to simulate a // all intercepted packets. These packets are held to simulate a
@ -635,8 +634,7 @@ func testForwardInterceptorRestart(ht *lntest.HarnessTest) {
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
FirstHopCustomRecords: customRecords, FirstHopCustomRecords: customRecords,
} }
ht.SendPaymentAssertInflight(alice, sendReq)
_ = alice.RPC.SendPayment(sendReq)
// We start the htlc interceptor with a simple implementation that saves // We start the htlc interceptor with a simple implementation that saves
// all intercepted packets. These packets are held to simulate a // all intercepted packets. These packets are held to simulate a

View File

@ -44,7 +44,7 @@ func testHoldInvoiceForceClose(ht *lntest.HarnessTest) {
TimeoutSeconds: 60, TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
} }
alice.RPC.SendPayment(req) ht.SendPaymentAssertInflight(alice, req)
ht.AssertInvoiceState(stream, lnrpc.Invoice_ACCEPTED) ht.AssertInvoiceState(stream, lnrpc.Invoice_ACCEPTED)

View File

@ -131,7 +131,7 @@ func testHtlcTimeoutResolverExtractPreimageRemote(ht *lntest.HarnessTest) {
TimeoutSeconds: 60, TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
} }
alice.RPC.SendPayment(req) ht.SendPaymentAssertInflight(alice, req)
// Once the payment sent, Alice should have one outgoing HTLC active. // Once the payment sent, Alice should have one outgoing HTLC active.
ht.AssertOutgoingHTLCActive(alice, aliceChanPoint, payHash[:]) ht.AssertOutgoingHTLCActive(alice, aliceChanPoint, payHash[:])
@ -270,7 +270,7 @@ func testHtlcTimeoutResolverExtractPreimageLocal(ht *lntest.HarnessTest) {
TimeoutSeconds: 60, TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
} }
alice.RPC.SendPayment(req) ht.SendPaymentAssertInflight(alice, req)
// Once the payment sent, Alice should have one outgoing HTLC active. // Once the payment sent, Alice should have one outgoing HTLC active.
ht.AssertOutgoingHTLCActive(alice, aliceChanPoint, payHash[:]) ht.AssertOutgoingHTLCActive(alice, aliceChanPoint, payHash[:])

View File

@ -632,8 +632,10 @@ func testRejectHTLC(ht *lntest.HarnessTest) {
TimeoutSeconds: 60, TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
} }
payStream := alice.RPC.SendPayment(paymentReq) ht.SendPaymentAssertFail(
ht.AssertPaymentStatusFromStream(payStream, lnrpc.Payment_FAILED) alice, paymentReq,
lnrpc.PaymentFailureReason_FAILURE_REASON_NO_ROUTE,
)
ht.AssertLastHTLCError(alice, lnrpc.Failure_CHANNEL_DISABLED) ht.AssertLastHTLCError(alice, lnrpc.Failure_CHANNEL_DISABLED)

View File

@ -306,7 +306,7 @@ func runLocalClaimOutgoingHTLC(ht *lntest.HarnessTest,
routeHints = makeRouteHints(bob, carol, params.ZeroConf) routeHints = makeRouteHints(bob, carol, params.ZeroConf)
} }
alice.RPC.SendPayment(&routerrpc.SendPaymentRequest{ req := &routerrpc.SendPaymentRequest{
Dest: carolPubKey, Dest: carolPubKey,
Amt: int64(dustHtlcAmt), Amt: int64(dustHtlcAmt),
PaymentHash: dustPayHash, PaymentHash: dustPayHash,
@ -314,9 +314,10 @@ func runLocalClaimOutgoingHTLC(ht *lntest.HarnessTest,
TimeoutSeconds: 60, TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
RouteHints: routeHints, RouteHints: routeHints,
}) }
ht.SendPaymentAssertInflight(alice, req)
alice.RPC.SendPayment(&routerrpc.SendPaymentRequest{ req = &routerrpc.SendPaymentRequest{
Dest: carolPubKey, Dest: carolPubKey,
Amt: int64(htlcAmt), Amt: int64(htlcAmt),
PaymentHash: payHash, PaymentHash: payHash,
@ -324,7 +325,8 @@ func runLocalClaimOutgoingHTLC(ht *lntest.HarnessTest,
TimeoutSeconds: 60, TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
RouteHints: routeHints, RouteHints: routeHints,
}) }
ht.SendPaymentAssertInflight(alice, req)
// Verify that all nodes in the path now have two HTLC's with the // Verify that all nodes in the path now have two HTLC's with the
// proper parameters. // proper parameters.
@ -653,7 +655,7 @@ func runMultiHopReceiverPreimageClaim(ht *lntest.HarnessTest,
TimeoutSeconds: 60, TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
} }
alice.RPC.SendPayment(req) ht.SendPaymentAssertInflight(alice, req)
// At this point, all 3 nodes should now have an active channel with // At this point, all 3 nodes should now have an active channel with
// the created HTLC pending on all of them. // the created HTLC pending on all of them.
@ -1014,7 +1016,7 @@ func runLocalForceCloseBeforeHtlcTimeout(ht *lntest.HarnessTest,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
RouteHints: routeHints, RouteHints: routeHints,
} }
alice.RPC.SendPayment(req) ht.SendPaymentAssertInflight(alice, req)
// Once the HTLC has cleared, all channels in our mini network should // Once the HTLC has cleared, all channels in our mini network should
// have the it locked in. // have the it locked in.
@ -1343,7 +1345,7 @@ func runRemoteForceCloseBeforeHtlcTimeout(ht *lntest.HarnessTest,
TimeoutSeconds: 60, TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
} }
alice.RPC.SendPayment(req) ht.SendPaymentAssertInflight(alice, req)
// Once the HTLC has cleared, all the nodes in our mini network should // Once the HTLC has cleared, all the nodes in our mini network should
// show that the HTLC has been locked in. // show that the HTLC has been locked in.
@ -1602,7 +1604,7 @@ func runLocalClaimIncomingHTLC(ht *lntest.HarnessTest,
TimeoutSeconds: 60, TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
} }
alice.RPC.SendPayment(req) ht.SendPaymentAssertInflight(alice, req)
// At this point, all 3 nodes should now have an active channel with // At this point, all 3 nodes should now have an active channel with
// the created HTLC pending on all of them. // the created HTLC pending on all of them.
@ -1913,7 +1915,7 @@ func runLocalClaimIncomingHTLCLeased(ht *lntest.HarnessTest,
TimeoutSeconds: 60, TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
} }
alice.RPC.SendPayment(req) ht.SendPaymentAssertInflight(alice, req)
// At this point, all 3 nodes should now have an active channel with // At this point, all 3 nodes should now have an active channel with
// the created HTLC pending on all of them. // the created HTLC pending on all of them.
@ -2268,7 +2270,7 @@ func runLocalPreimageClaim(ht *lntest.HarnessTest,
TimeoutSeconds: 60, TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
} }
alice.RPC.SendPayment(req) ht.SendPaymentAssertInflight(alice, req)
// At this point, all 3 nodes should now have an active channel with // At this point, all 3 nodes should now have an active channel with
// the created HTLC pending on all of them. // the created HTLC pending on all of them.
@ -2551,7 +2553,7 @@ func runLocalPreimageClaimLeased(ht *lntest.HarnessTest,
TimeoutSeconds: 60, TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
} }
alice.RPC.SendPayment(req) ht.SendPaymentAssertInflight(alice, req)
// At this point, all 3 nodes should now have an active channel with // At this point, all 3 nodes should now have an active channel with
// the created HTLC pending on all of them. // the created HTLC pending on all of them.
@ -2998,7 +3000,7 @@ func runHtlcAggregation(ht *lntest.HarnessTest,
TimeoutSeconds: 60, TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
} }
alice.RPC.SendPayment(req) ht.SendPaymentAssertInflight(alice, req)
} }
// And Carol will pay Alice's. // And Carol will pay Alice's.
@ -3008,7 +3010,7 @@ func runHtlcAggregation(ht *lntest.HarnessTest,
TimeoutSeconds: 60, TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat, FeeLimitMsat: noFeeLimitMsat,
} }
carol.RPC.SendPayment(req) ht.SendPaymentAssertInflight(carol, req)
} }
// At this point, all 3 nodes should now the HTLCs active on their // At this point, all 3 nodes should now the HTLCs active on their

View File

@ -655,17 +655,12 @@ func generateBackups(ht *lntest.HarnessTest, srcNode,
) )
send := func(node *node.HarnessNode, payReq string) { send := func(node *node.HarnessNode, payReq string) {
stream := node.RPC.SendPayment( req := &routerrpc.SendPaymentRequest{
&routerrpc.SendPaymentRequest{ PaymentRequest: payReq,
PaymentRequest: payReq, TimeoutSeconds: 60,
TimeoutSeconds: 60, FeeLimitMsat: noFeeLimitMsat,
FeeLimitMsat: noFeeLimitMsat, }
}, ht.SendPaymentAssertSettled(node, req)
)
ht.AssertPaymentStatusFromStream(
stream, lnrpc.Payment_SUCCEEDED,
)
} }
// Pay each invoice. // Pay each invoice.