Skip to content

Commit 453f353

Browse files
GeorgeTsagkffranr
authored andcommitted
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 b7089fa commit 453f353

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
@@ -2675,8 +2675,8 @@ func testCustomChannelsLiquidityEdgeCasesCore(ctx context.Context,
26752675
logBalance(t.t, nodes, assetID, "after manual rfq hodl")
26762676

26772677
// Edge case: Charlie negotiates a quote with Dave which has a low max
2678-
// amount (~170k sats). Then Charlie creates an invoice with a total
2679-
// amount slightly larger than the max allowed in the quote (200k sats).
2678+
// amount (~17k sats). Then Charlie creates an invoice with a total
2679+
// amount slightly larger than the max allowed in the quote (30k sats).
26802680
// Erin will try to pay that invoice with sats, in shards of max size
26812681
// 80k sats. Dave will eventually stop forwarding HTLCs as the RFQ HTLC
26822682
// tracking mechanism should stop them from being forwarded, as they
@@ -2687,7 +2687,7 @@ func testCustomChannelsLiquidityEdgeCasesCore(ctx context.Context,
26872687
res, err := charlieTap.RfqClient.AddAssetBuyOrder(
26882688
ctx, &rfqrpc.AddAssetBuyOrderRequest{
26892689
AssetSpecifier: &assetSpecifier,
2690-
AssetMaxAmt: 10_000,
2690+
AssetMaxAmt: 1_000,
26912691
Expiry: uint64(inOneHour.Unix()),
26922692
PeerPubKey: dave.PubKey[:],
26932693
TimeoutSeconds: 10,
@@ -2703,7 +2703,7 @@ func testCustomChannelsLiquidityEdgeCasesCore(ctx context.Context,
27032703
// manually generated, quote.
27042704
iResp, err := charlie.AddInvoice(ctx, &lnrpc.Invoice{
27052705
Memo: "",
2706-
Value: 200_000,
2706+
Value: 30_000,
27072707
RPreimage: bytes.Repeat([]byte{11}, 32),
27082708
CltvExpiry: 60,
27092709
RouteHints: []*lnrpc.RouteHint{{
@@ -2718,11 +2718,22 @@ func testCustomChannelsLiquidityEdgeCasesCore(ctx context.Context,
27182718
// Now Erin tries to pay the invoice. Since rfq quote cannot satisfy the
27192719
// total amount of the invoice this payment will fail.
27202720
payInvoiceWithSatoshi(
2721-
t.t, erin, iResp, withPayErrSubStr("context deadline exceeded"),
2722-
withFailure(lnrpc.Payment_FAILED, failureNone),
2723-
withGroupKey(groupID),
2721+
t.t, erin, iResp,
2722+
withFailure(lnrpc.Payment_FAILED, failureNoRoute),
2723+
withGroupKey(groupID), withSmallShards(),
27242724
)
27252725

2726+
// Let's also cancel the invoice and assert that no HTLCs are still
2727+
// in-flight.
2728+
_, err = charlie.InvoicesClient.CancelInvoice(
2729+
ctx, &invoicesrpc.CancelInvoiceMsg{
2730+
PaymentHash: iResp.RHash,
2731+
},
2732+
)
2733+
require.NoError(t.t, err)
2734+
2735+
assertNumHtlcs(t.t, dave, 0)
2736+
27262737
logBalance(t.t, nodes, assetID, "after small manual rfq")
27272738

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

0 commit comments

Comments
 (0)