Skip to content

Commit 2a5d3b2

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 9cd8b38 commit 2a5d3b2

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

26962696
// Edge case: Charlie negotiates a quote with Dave which has a low max
2697-
// amount (~170k sats). Then Charlie creates an invoice with a total
2698-
// amount slightly larger than the max allowed in the quote (200k sats).
2697+
// amount (~17k sats). Then Charlie creates an invoice with a total
2698+
// amount slightly larger than the max allowed in the quote (30k sats).
26992699
// Erin will try to pay that invoice with sats, in shards of max size
27002700
// 80k sats. Dave will eventually stop forwarding HTLCs as the RFQ HTLC
27012701
// tracking mechanism should stop them from being forwarded, as they
@@ -2706,7 +2706,7 @@ func testCustomChannelsLiquidityEdgeCasesCore(ctx context.Context,
27062706
res, err := charlieTap.RfqClient.AddAssetBuyOrder(
27072707
ctx, &rfqrpc.AddAssetBuyOrderRequest{
27082708
AssetSpecifier: &assetSpecifier,
2709-
AssetMaxAmt: 10_000,
2709+
AssetMaxAmt: 1_000,
27102710
Expiry: uint64(inOneHour.Unix()),
27112711
PeerPubKey: dave.PubKey[:],
27122712
TimeoutSeconds: 10,
@@ -2722,7 +2722,7 @@ func testCustomChannelsLiquidityEdgeCasesCore(ctx context.Context,
27222722
// manually generated, quote.
27232723
iResp, err := charlie.AddInvoice(ctx, &lnrpc.Invoice{
27242724
Memo: "",
2725-
Value: 200_000,
2725+
Value: 30_000,
27262726
RPreimage: bytes.Repeat([]byte{11}, 32),
27272727
CltvExpiry: 60,
27282728
RouteHints: []*lnrpc.RouteHint{{
@@ -2737,11 +2737,22 @@ func testCustomChannelsLiquidityEdgeCasesCore(ctx context.Context,
27372737
// Now Erin tries to pay the invoice. Since rfq quote cannot satisfy the
27382738
// total amount of the invoice this payment will fail.
27392739
payInvoiceWithSatoshi(
2740-
t.t, erin, iResp, withPayErrSubStr("context deadline exceeded"),
2741-
withFailure(lnrpc.Payment_FAILED, failureNone),
2742-
withGroupKey(groupID),
2740+
t.t, erin, iResp,
2741+
withFailure(lnrpc.Payment_FAILED, failureNoRoute),
2742+
withGroupKey(groupID), withSmallShards(),
27432743
)
27442744

2745+
// Let's also cancel the invoice and assert that no HTLCs are still
2746+
// in-flight.
2747+
_, err = charlie.InvoicesClient.CancelInvoice(
2748+
ctx, &invoicesrpc.CancelInvoiceMsg{
2749+
PaymentHash: iResp.RHash,
2750+
},
2751+
)
2752+
require.NoError(t.t, err)
2753+
2754+
assertNumHtlcs(t.t, dave, 0)
2755+
27452756
logBalance(t.t, nodes, assetID, "after small manual rfq")
27462757

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

0 commit comments

Comments
 (0)