Skip to content

Commit 35928c5

Browse files
committed
itest: add safe HTLC failure edge case for custom channels
1 parent b51522a commit 35928c5

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

itest/litd_custom_channels_test.go

+27
Original file line numberDiff line numberDiff line change
@@ -2163,6 +2163,33 @@ func testCustomChannelsLiquidityEdgeCases(ctx context.Context,
21632163
)
21642164

21652165
logBalance(t.t, nodes, assetID, "after small manual rfq")
2166+
2167+
// Edge case: Fabia creates an invoice which Erin cannot satisfy with
2168+
// his side of asset liquidity. This tests that Erin will not try to
2169+
// add an HTLC with more asset units than what his local balance is,
2170+
// eventually leading to a healthy payment failure. To validate that the
2171+
// channel is still healthy, we follow-up with a smaller invoice payment
2172+
// which is meant to succeed.
2173+
invoiceResp = createAssetInvoice(
2174+
t.t, erin, fabia, 125_000, assetID,
2175+
)
2176+
2177+
payInvoiceWithAssets(
2178+
t.t, charlie, dave, invoiceResp.PaymentRequest, assetID,
2179+
withSmallShards(),
2180+
withFailure(lnrpc.Payment_FAILED, failureTimeout),
2181+
)
2182+
2183+
invoiceResp = createAssetInvoice(
2184+
t.t, erin, fabia, 25_000, assetID,
2185+
)
2186+
2187+
payInvoiceWithAssets(
2188+
t.t, charlie, dave, invoiceResp.PaymentRequest, assetID,
2189+
withSmallShards(),
2190+
)
2191+
2192+
logBalance(t.t, nodes, assetID, "after safe HTLC failure")
21662193
}
21672194

21682195
// testCustomChannelsStrictForwarding is a test that tests the strict forwarding

0 commit comments

Comments
 (0)