@@ -2163,6 +2163,33 @@ func testCustomChannelsLiquidityEdgeCases(ctx context.Context,
2163
2163
)
2164
2164
2165
2165
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" )
2166
2193
}
2167
2194
2168
2195
// testCustomChannelsStrictForwarding is a test that tests the strict forwarding
0 commit comments