@@ -2971,10 +2971,11 @@ func testCustomChannelsLiquidityEdgeCasesGroup(ctx context.Context,
2971
2971
testCustomChannelsLiquidityEdgeCasesCore (ctx , net , t , true )
2972
2972
}
2973
2973
2974
- // testCustomChannelsMultiRFQReceive tests that a node creating an invoice with
2975
- // multiple RFQ quotes can actually guide the payer into using multiple private
2976
- // taproot asset channels to pay the invoice.
2977
- func testCustomChannelsMultiRFQReceive (ctx context.Context , net * NetworkHarness ,
2974
+ // testCustomChannelsMultiRFQ tests that sending and receiving payments works
2975
+ // when using the multi-rfq features of tapd. This means that liquidity across
2976
+ // multiple channels and peers can be used to send out a payment, or receive to
2977
+ // an invoice.
2978
+ func testCustomChannelsMultiRFQ (ctx context.Context , net * NetworkHarness ,
2978
2979
t * harnessTest ) {
2979
2980
2980
2981
lndArgs := slices .Clone (lndArgsTemplate )
@@ -3068,7 +3069,6 @@ func testCustomChannelsMultiRFQReceive(ctx context.Context, net *NetworkHarness,
3068
3069
t .t , charlie , & lnrpc.AddInvoiceResponse {
3069
3070
PaymentRequest : hodlInv .payReq ,
3070
3071
},
3071
- withGroupKey (groupID ),
3072
3072
withFailure (lnrpc .Payment_IN_FLIGHT , failureNone ),
3073
3073
)
3074
3074
@@ -3100,13 +3100,88 @@ func testCustomChannelsMultiRFQReceive(ctx context.Context, net *NetworkHarness,
3100
3100
// Now let's create a normal invoice that will be settled once all the
3101
3101
// HTLCs have been received. This is only possible because the payer
3102
3102
// uses multiple bolt11 hop hints to reach the destination.
3103
- invoiceResp := createAssetInvoice (t .t , nil , fabia , 15_000 , assetID )
3103
+ invoiceResp := createAssetInvoice (
3104
+ t .t , nil , fabia , 15_000 , nil , withInvGroupKey (groupID ),
3105
+ )
3104
3106
3105
3107
payInvoiceWithSatoshi (
3106
- t .t , charlie , invoiceResp , withGroupKey ( groupID ),
3108
+ t .t , charlie , invoiceResp ,
3107
3109
)
3108
3110
3109
3111
logBalance (t .t , nodes , assetID , "after multi-rfq receive" )
3112
+
3113
+ // Now we'll test that sending with multiple rfq quotes works.
3114
+
3115
+ // Let's start by providing some liquidity to Charlie's peers, in order
3116
+ // for them to be able to push some amount if Fabia picks them as part
3117
+ // of the route.
3118
+ sendKeySendPayment (t .t , charlie , erin , 800_000 )
3119
+ sendKeySendPayment (t .t , charlie , dave , 800_000 )
3120
+ sendKeySendPayment (t .t , charlie , yara , 800_000 )
3121
+
3122
+ // Let's ask for the rough equivalent of ~15k assets. Fabia, who's going
3123
+ // to pay the invoice, only has parts of assets that are less than 10k
3124
+ // in channels with one of the 3 intermediate peers. The only way to
3125
+ // pay this invoice is by splitting the payment across multiple peers by
3126
+ // using multiple RFQ quotes.
3127
+ invAmt := int64 (15_000 * 17 )
3128
+
3129
+ iResp , err := charlie .AddHoldInvoice (
3130
+ ctx , & invoicesrpc.AddHoldInvoiceRequest {
3131
+ Memo : "" ,
3132
+ Value : invAmt ,
3133
+ Hash : payHash [:],
3134
+ },
3135
+ )
3136
+ require .NoError (t .t , err )
3137
+
3138
+ payReq := iResp .PaymentRequest
3139
+
3140
+ payInvoiceWithAssets (
3141
+ t .t , fabia , nil , payReq , assetID ,
3142
+ withFailure (lnrpc .Payment_IN_FLIGHT , failureNone ),
3143
+ )
3144
+
3145
+ assertMinNumHtlcs (t .t , charlie , 2 )
3146
+ assertMinNumHtlcs (t .t , fabia , 2 )
3147
+
3148
+ logBalance (t .t , nodes , assetID , "multi-rfq send in-flight" )
3149
+
3150
+ _ , err = charlie .SettleInvoice (ctx , & invoicesrpc.SettleInvoiceMsg {
3151
+ Preimage : hodlInv .preimage [:],
3152
+ })
3153
+ require .NoError (t .t , err )
3154
+
3155
+ assertNumHtlcs (t .t , charlie , 0 )
3156
+ assertNumHtlcs (t .t , fabia , 0 )
3157
+
3158
+ logBalance (t .t , nodes , assetID , "after multi-rfq send" )
3159
+
3160
+ // Let's make another round-trip involving multi-rfq functionality.
3161
+ // Let's have Fabia receive another large payment and send it back
3162
+ // again, this time with a greater amount.
3163
+ invoiceResp = createAssetInvoice (t .t , nil , fabia , 25_000 , assetID )
3164
+
3165
+ payInvoiceWithSatoshi (
3166
+ t .t , charlie , invoiceResp ,
3167
+ )
3168
+
3169
+ logBalance (t .t , nodes , assetID , "after multi-rfq receive (2nd)" )
3170
+
3171
+ // Let's bump up the invoice amount a bit, to roughly ~22k assets.
3172
+ invAmt = 22_000 * 17
3173
+ inv , err := charlie .AddInvoice (ctx , & lnrpc.Invoice {
3174
+ Value : invAmt ,
3175
+ })
3176
+ require .NoError (t .t , err )
3177
+
3178
+ payReq = inv .PaymentRequest
3179
+
3180
+ payInvoiceWithAssets (
3181
+ t .t , fabia , nil , payReq , nil , withGroupKey (groupID ),
3182
+ )
3183
+
3184
+ logBalance (t .t , nodes , assetID , "after multi-rfq send (2nd)" )
3110
3185
}
3111
3186
3112
3187
// testCustomChannelsStrictForwarding is a test that tests the strict forwarding
0 commit comments