diff --git a/itest/assets_test.go b/itest/assets_test.go index 97b399fe0..7607d6836 100644 --- a/itest/assets_test.go +++ b/itest/assets_test.go @@ -719,7 +719,7 @@ func sendAssetKeySendPayment(t *testing.T, src, dst *HarnessNode, amt uint64, expectedReason := failReason.UnwrapOr( lnrpc.PaymentFailureReason_FAILURE_REASON_NONE, ) - require.Equal(t, result.FailureReason, expectedReason) + require.Equal(t, expectedReason, result.FailureReason) } func sendKeySendPayment(t *testing.T, src, dst *HarnessNode, @@ -772,7 +772,10 @@ func createAndPayNormalInvoiceWithBtc(t *testing.T, src, dst *HarnessNode, }) require.NoError(t, err) - payInvoiceWithSatoshi(t, src, invoiceResp, lnrpc.Payment_SUCCEEDED) + payInvoiceWithSatoshi( + t, src, invoiceResp, lnrpc.Payment_SUCCEEDED, + fn.None[lnrpc.PaymentFailureReason](), + ) } func createAndPayNormalInvoice(t *testing.T, src, rfqPeer, dst *HarnessNode, @@ -800,7 +803,8 @@ func createAndPayNormalInvoice(t *testing.T, src, rfqPeer, dst *HarnessNode, func payInvoiceWithSatoshi(t *testing.T, payer *HarnessNode, invoice *lnrpc.AddInvoiceResponse, - expectedStatus lnrpc.Payment_PaymentStatus) { + expectedStatus lnrpc.Payment_PaymentStatus, + failReason fn.Option[lnrpc.PaymentFailureReason]) { ctxb := context.Background() ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) @@ -818,6 +822,11 @@ func payInvoiceWithSatoshi(t *testing.T, payer *HarnessNode, result, err := getPaymentResult(stream) require.NoError(t, err) require.Equal(t, expectedStatus, result.Status) + + expectedReason := failReason.UnwrapOr( + lnrpc.PaymentFailureReason_FAILURE_REASON_NONE, + ) + require.Equal(t, expectedReason, result.FailureReason) } func payInvoiceWithSatoshiLastHop(t *testing.T, payer *HarnessNode, diff --git a/itest/litd_custom_channels_test.go b/itest/litd_custom_channels_test.go index 0990d051f..8e335f72d 100644 --- a/itest/litd_custom_channels_test.go +++ b/itest/litd_custom_channels_test.go @@ -18,6 +18,8 @@ import ( "github.com/lightninglabs/taproot-assets/tapchannel" "github.com/lightninglabs/taproot-assets/taprpc" "github.com/lightninglabs/taproot-assets/taprpc/mintrpc" + oraclerpc "github.com/lightninglabs/taproot-assets/taprpc/priceoraclerpc" + "github.com/lightninglabs/taproot-assets/taprpc/rfqrpc" tchrpc "github.com/lightninglabs/taproot-assets/taprpc/tapchannelrpc" "github.com/lightninglabs/taproot-assets/taprpc/universerpc" "github.com/lightninglabs/taproot-assets/tapscript" @@ -48,6 +50,10 @@ var ( shortTimeout = time.Second * 5 defaultPaymentStatus = fn.None[lnrpc.Payment_PaymentStatus]() + + // nolint: lll + errNoBalance = lnrpc.PaymentFailureReason_FAILURE_REASON_INSUFFICIENT_BALANCE + errNoRoute = lnrpc.PaymentFailureReason_FAILURE_REASON_NO_ROUTE ) var ( @@ -528,6 +534,7 @@ func testCustomChannels(_ context.Context, net *NetworkHarness, ) payInvoiceWithSatoshi( t.t, charlie, invoiceResp, lnrpc.Payment_FAILED, + fn.None[lnrpc.PaymentFailureReason](), ) logBalance(t.t, nodes, assetID, "after asset invoice paid with sats") @@ -574,7 +581,10 @@ func testCustomChannels(_ context.Context, net *NetworkHarness, invoiceResp = createAssetInvoice( t.t, erin, fabia, fabiaInvoiceAssetAmount2, assetID, ) - payInvoiceWithSatoshi(t.t, dave, invoiceResp, lnrpc.Payment_SUCCEEDED) + payInvoiceWithSatoshi( + t.t, dave, invoiceResp, lnrpc.Payment_SUCCEEDED, + fn.None[lnrpc.PaymentFailureReason](), + ) logBalance(t.t, nodes, assetID, "after invoice") erinAssetBalance -= fabiaInvoiceAssetAmount2 @@ -1006,7 +1016,10 @@ func testCustomChannelsGroupedAsset(_ context.Context, net *NetworkHarness, invoiceResp = createAssetInvoice( t.t, erin, fabia, fabiaInvoiceAssetAmount2, assetID, ) - payInvoiceWithSatoshi(t.t, dave, invoiceResp, lnrpc.Payment_SUCCEEDED) + payInvoiceWithSatoshi( + t.t, dave, invoiceResp, lnrpc.Payment_SUCCEEDED, + fn.None[lnrpc.PaymentFailureReason](), + ) logBalance(t.t, nodes, assetID, "after invoice") erinAssetBalance -= fabiaInvoiceAssetAmount2 @@ -2015,7 +2028,10 @@ func testCustomChannelsLiquidityEdgeCases(_ context.Context, // channels, where the total asset value is less than the default anchor // amount of 354 sats. invoiceResp = createAssetInvoice(t.t, dave, charlie, 1, assetID) - payInvoiceWithSatoshi(t.t, yara, invoiceResp, lnrpc.Payment_FAILED) + payInvoiceWithSatoshi( + t.t, yara, invoiceResp, lnrpc.Payment_FAILED, + fn.Some(lnrpc.PaymentFailureReason_FAILURE_REASON_NO_ROUTE), + ) logBalance(t.t, nodes, assetID, "after small payment (asset "+ "invoice, <354sats)") @@ -2686,7 +2702,7 @@ func testCustomChannelsOraclePricing(_ context.Context, ) } -// testCustomChannelsFee tests the whether the custom channel funding process +// testCustomChannelsFee tests whether the custom channel funding process // fails if the proposed fee rate is lower than the minimum relay fee. func testCustomChannelsFee(_ context.Context, net *NetworkHarness, t *harnessTest) {