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