Skip to content

Commit a9e4bfc

Browse files
GeorgeTsagkguggero
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 15c2e98 commit a9e4bfc

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

itest/litd_custom_channels_test.go

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2676,8 +2676,8 @@ func testCustomChannelsLiquidityEdgeCasesCore(ctx context.Context,
26762676
logBalance(t.t, nodes, assetID, "after manual rfq hodl")
26772677

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

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

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

0 commit comments

Comments
 (0)