@@ -24,9 +24,6 @@ import (
24
24
)
25
25
26
26
const (
27
- // The test channel ID to use across the test cases.
28
- testChanID = 1234
29
-
30
27
// maxRandomInvoiceValueMSat is the maximum invoice value in mSAT to be
31
28
// generated by the property based tests.
32
29
maxRandomInvoiceValueMSat = 100_000_000_000
@@ -52,12 +49,20 @@ var (
52
49
// The node ID to be used for the RFQ peer.
53
50
testNodeID = route.Vertex {1 , 2 , 3 }
54
51
52
+ // The asset rate value to use across tests.
55
53
assetRate = big .NewInt (100_000 )
56
54
55
+ // The asset rate struct based on the assetRate value.
57
56
testAssetRate = rfqmath.FixedPoint [rfqmath.BigInt ]{
58
57
Coefficient : rfqmath .NewBigInt (assetRate ),
59
58
Scale : 0 ,
60
59
}
60
+
61
+ // The test RFQ ID to use across tests.
62
+ testRfqID = dummyRfqID (31 )
63
+
64
+ // The test RFQ SCID that is derived from testRfqID.
65
+ testScid = testRfqID .Scid ()
61
66
)
62
67
63
68
// mockRfqManager mocks the interface of the rfq manager required by the aux
@@ -184,6 +189,11 @@ func (m *mockHtlcModifierProperty) HtlcModifier(ctx context.Context,
184
189
if r .ExitHtlcAmt != res .AmtPaid {
185
190
m .t .Errorf ("AmtPaid != ExitHtlcAmt" )
186
191
}
192
+ } else if ! isAssetInvoice (r .Invoice , m ) {
193
+ if ! res .CancelSet {
194
+ m .t .Errorf ("expected cancel set flag" )
195
+ }
196
+ continue
187
197
}
188
198
189
199
htlcBlob , err := r .WireCustomRecords .Serialize ()
@@ -293,7 +303,7 @@ func TestAuxInvoiceManager(t *testing.T) {
293
303
},
294
304
},
295
305
buyQuotes : map [rfq.SerialisedScid ]rfqmsg.BuyAccept {
296
- testChanID : {
306
+ testScid : {
297
307
Peer : testNodeID ,
298
308
},
299
309
},
@@ -315,7 +325,7 @@ func TestAuxInvoiceManager(t *testing.T) {
315
325
},
316
326
},
317
327
buyQuotes : map [rfq.SerialisedScid ]rfqmsg.BuyAccept {
318
- testChanID : {
328
+ testScid : {
319
329
Peer : testNodeID ,
320
330
},
321
331
},
@@ -335,7 +345,7 @@ func TestAuxInvoiceManager(t *testing.T) {
335
345
dummyAssetID (1 ),
336
346
3 ,
337
347
),
338
- }, fn .Some (dummyRfqID ( 31 ) ),
348
+ }, fn .Some (testRfqID ),
339
349
),
340
350
},
341
351
},
@@ -345,7 +355,7 @@ func TestAuxInvoiceManager(t *testing.T) {
345
355
},
346
356
},
347
357
buyQuotes : rfq.BuyAcceptMap {
348
- fn . Ptr ( dummyRfqID ( 31 )). Scid () : {
358
+ testScid : {
349
359
Peer : testNodeID ,
350
360
AssetRate : rfqmsg .NewAssetRate (
351
361
testAssetRate , time .Now (),
@@ -368,7 +378,7 @@ func TestAuxInvoiceManager(t *testing.T) {
368
378
dummyAssetID (1 ),
369
379
4 ,
370
380
),
371
- }, fn .Some (dummyRfqID ( 31 ) ),
381
+ }, fn .Some (testRfqID ),
372
382
),
373
383
ExitHtlcAmt : 1234 ,
374
384
},
@@ -379,14 +389,39 @@ func TestAuxInvoiceManager(t *testing.T) {
379
389
},
380
390
},
381
391
buyQuotes : rfq.BuyAcceptMap {
382
- fn . Ptr ( dummyRfqID ( 31 )). Scid () : {
392
+ testScid : {
383
393
Peer : testNodeID ,
384
394
AssetRate : rfqmsg .NewAssetRate (
385
395
testAssetRate , time .Now (),
386
396
),
387
397
},
388
398
},
389
399
},
400
+ {
401
+ name : "btc invoice, custom records" ,
402
+ requests : []lndclient.InvoiceHtlcModifyRequest {
403
+ {
404
+ Invoice : & lnrpc.Invoice {
405
+ ValueMsat : 10_000_000 ,
406
+ PaymentAddr : []byte {1 , 1 , 1 },
407
+ },
408
+ WireCustomRecords : newWireCustomRecords (
409
+ t , []* rfqmsg.AssetBalance {
410
+ rfqmsg .NewAssetBalance (
411
+ dummyAssetID (1 ),
412
+ 4 ,
413
+ ),
414
+ }, fn .Some (testRfqID ),
415
+ ),
416
+ ExitHtlcAmt : 1234 ,
417
+ },
418
+ },
419
+ responses : []lndclient.InvoiceHtlcModifyResponse {
420
+ {
421
+ CancelSet : true ,
422
+ },
423
+ },
424
+ },
390
425
}
391
426
392
427
for _ , testCase := range testCases {
@@ -761,8 +796,8 @@ func testRouteHints() []*lnrpc.RouteHint {
761
796
NodeId : route.Vertex {1 , 1 , 1 }.String (),
762
797
},
763
798
{
764
- ChanId : 1234 ,
765
- NodeId : route. Vertex { 1 , 2 , 3 } .String (),
799
+ ChanId : uint64 ( testScid ) ,
800
+ NodeId : testNodeID .String (),
766
801
},
767
802
},
768
803
},
0 commit comments