Skip to content

Commit 3a59149

Browse files
committed
itest: make small manual rfq edge case faster
We lower the amounts for the manual rfq quote and the corresponding invoice in order to make the payment fail faster. Previously we'd get many layers of sharding over the payment which would lead to a timeout, so we'd wait for that. Now with the lower amounts we're hitting the min shard amount faster, leading to a NoRoute failure.
1 parent b8b5980 commit 3a59149

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

itest/litd_custom_channels_test.go

+18-7
Original file line numberDiff line numberDiff line change
@@ -3056,8 +3056,8 @@ func testCustomChannelsLiquidityEdgeCasesCore(ctx context.Context,
30563056
logBalance(t.t, nodes, assetID, "after manual rfq hodl")
30573057

30583058
// Edge case: Charlie negotiates a quote with Dave which has a low max
3059-
// amount (~170k sats). Then Charlie creates an invoice with a total
3060-
// amount slightly larger than the max allowed in the quote (200k sats).
3059+
// amount (~17k sats). Then Charlie creates an invoice with a total
3060+
// amount slightly larger than the max allowed in the quote (30k sats).
30613061
// Erin will try to pay that invoice with sats, in shards of max size
30623062
// 80k sats. Dave will eventually stop forwarding HTLCs as the RFQ HTLC
30633063
// tracking mechanism should stop them from being forwarded, as they
@@ -3068,7 +3068,7 @@ func testCustomChannelsLiquidityEdgeCasesCore(ctx context.Context,
30683068
res, err := charlieTap.RfqClient.AddAssetBuyOrder(
30693069
ctx, &rfqrpc.AddAssetBuyOrderRequest{
30703070
AssetSpecifier: &assetSpecifier,
3071-
AssetMaxAmt: 10_000,
3071+
AssetMaxAmt: 1_000,
30723072
Expiry: uint64(inOneHour.Unix()),
30733073
PeerPubKey: dave.PubKey[:],
30743074
TimeoutSeconds: 10,
@@ -3084,7 +3084,7 @@ func testCustomChannelsLiquidityEdgeCasesCore(ctx context.Context,
30843084
// manually generated, quote.
30853085
iResp, err := charlie.AddInvoice(ctx, &lnrpc.Invoice{
30863086
Memo: "",
3087-
Value: 200_000,
3087+
Value: 30_000,
30883088
RPreimage: bytes.Repeat([]byte{11}, 32),
30893089
CltvExpiry: 60,
30903090
RouteHints: []*lnrpc.RouteHint{{
@@ -3099,11 +3099,22 @@ func testCustomChannelsLiquidityEdgeCasesCore(ctx context.Context,
30993099
// Now Erin tries to pay the invoice. Since rfq quote cannot satisfy the
31003100
// total amount of the invoice this payment will fail.
31013101
payInvoiceWithSatoshi(
3102-
t.t, erin, iResp, withPayErrSubStr("context deadline exceeded"),
3103-
withFailure(lnrpc.Payment_FAILED, failureNone),
3104-
withGroupKey(groupID),
3102+
t.t, erin, iResp,
3103+
withFailure(lnrpc.Payment_FAILED, failureNoRoute),
3104+
withGroupKey(groupID), withSmallShards(),
31053105
)
31063106

3107+
// Let's also cancel the invoice and assert that no HTLCs are still
3108+
// in-flight.
3109+
_, err = charlie.InvoicesClient.CancelInvoice(
3110+
ctx, &invoicesrpc.CancelInvoiceMsg{
3111+
PaymentHash: iResp.RHash,
3112+
},
3113+
)
3114+
require.NoError(t.t, err)
3115+
3116+
assertNumHtlcs(t.t, dave, 0)
3117+
31073118
logBalance(t.t, nodes, assetID, "after small manual rfq")
31083119

31093120
// Edge case: Fabia creates an invoice which Erin cannot satisfy with

0 commit comments

Comments
 (0)