@@ -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
@@ -293,7 +298,7 @@ func TestAuxInvoiceManager(t *testing.T) {
293
298
},
294
299
},
295
300
buyQuotes : map [rfq.SerialisedScid ]rfqmsg.BuyAccept {
296
- testChanID : {
301
+ testScid : {
297
302
Peer : testNodeID ,
298
303
},
299
304
},
@@ -315,7 +320,7 @@ func TestAuxInvoiceManager(t *testing.T) {
315
320
},
316
321
},
317
322
buyQuotes : map [rfq.SerialisedScid ]rfqmsg.BuyAccept {
318
- testChanID : {
323
+ testScid : {
319
324
Peer : testNodeID ,
320
325
},
321
326
},
@@ -335,7 +340,7 @@ func TestAuxInvoiceManager(t *testing.T) {
335
340
dummyAssetID (1 ),
336
341
3 ,
337
342
),
338
- }, fn .Some (dummyRfqID ( 31 ) ),
343
+ }, fn .Some (testRfqID ),
339
344
),
340
345
},
341
346
},
@@ -345,7 +350,7 @@ func TestAuxInvoiceManager(t *testing.T) {
345
350
},
346
351
},
347
352
buyQuotes : rfq.BuyAcceptMap {
348
- fn . Ptr ( dummyRfqID ( 31 )). Scid () : {
353
+ testScid : {
349
354
Peer : testNodeID ,
350
355
AssetRate : rfqmsg .NewAssetRate (
351
356
testAssetRate , time .Now (),
@@ -368,7 +373,7 @@ func TestAuxInvoiceManager(t *testing.T) {
368
373
dummyAssetID (1 ),
369
374
4 ,
370
375
),
371
- }, fn .Some (dummyRfqID ( 31 ) ),
376
+ }, fn .Some (testRfqID ),
372
377
),
373
378
ExitHtlcAmt : 1234 ,
374
379
},
@@ -379,14 +384,39 @@ func TestAuxInvoiceManager(t *testing.T) {
379
384
},
380
385
},
381
386
buyQuotes : rfq.BuyAcceptMap {
382
- fn . Ptr ( dummyRfqID ( 31 )). Scid () : {
387
+ testScid : {
383
388
Peer : testNodeID ,
384
389
AssetRate : rfqmsg .NewAssetRate (
385
390
testAssetRate , time .Now (),
386
391
),
387
392
},
388
393
},
389
394
},
395
+ {
396
+ name : "btc invoice, custom records" ,
397
+ requests : []lndclient.InvoiceHtlcModifyRequest {
398
+ {
399
+ Invoice : & lnrpc.Invoice {
400
+ ValueMsat : 10_000_000 ,
401
+ PaymentAddr : []byte {1 , 1 , 1 },
402
+ },
403
+ WireCustomRecords : newWireCustomRecords (
404
+ t , []* rfqmsg.AssetBalance {
405
+ rfqmsg .NewAssetBalance (
406
+ dummyAssetID (1 ),
407
+ 4 ,
408
+ ),
409
+ }, fn .Some (testRfqID ),
410
+ ),
411
+ ExitHtlcAmt : 1234 ,
412
+ },
413
+ },
414
+ responses : []lndclient.InvoiceHtlcModifyResponse {
415
+ {
416
+ CancelSet : true ,
417
+ },
418
+ },
419
+ },
390
420
}
391
421
392
422
for _ , testCase := range testCases {
@@ -761,8 +791,8 @@ func testRouteHints() []*lnrpc.RouteHint {
761
791
NodeId : route.Vertex {1 , 1 , 1 }.String (),
762
792
},
763
793
{
764
- ChanId : 1234 ,
765
- NodeId : route. Vertex { 1 , 2 , 3 } .String (),
794
+ ChanId : uint64 ( testScid ) ,
795
+ NodeId : testNodeID .String (),
766
796
},
767
797
},
768
798
},
0 commit comments