@@ -1282,6 +1282,20 @@ func assertChannelAssetBalanceWithDelta(t *testing.T, node *HarnessNode,
1282
1282
require .InDelta (t , remote , assetBalance .RemoteBalance , delta )
1283
1283
}
1284
1284
1285
+ func channelAssetBalance (t * testing.T , node * HarnessNode ,
1286
+ chanPoint * lnrpc.ChannelPoint ) (uint64 , uint64 ) {
1287
+
1288
+ targetChan := fetchChannel (t , node , chanPoint )
1289
+
1290
+ var assetBalance rfqmsg.JsonAssetChannel
1291
+ err := json .Unmarshal (targetChan .CustomChannelData , & assetBalance )
1292
+ require .NoError (t , err )
1293
+
1294
+ require .GreaterOrEqual (t , len (assetBalance .FundingAssets ), 1 )
1295
+
1296
+ return assetBalance .LocalBalance , assetBalance .RemoteBalance
1297
+ }
1298
+
1285
1299
// addRoutingFee adds the default routing fee (1 part per million fee rate plus
1286
1300
// 1000 milli-satoshi base fee) to the given milli-satoshi amount.
1287
1301
func addRoutingFee (amt lnwire.MilliSatoshi ) lnwire.MilliSatoshi {
@@ -1321,6 +1335,8 @@ func sendAssetKeySendPayment(t *testing.T, src, dst *HarnessNode, amt uint64,
1321
1335
PaymentHash : hash [:],
1322
1336
TimeoutSeconds : int32 (PaymentTimeout .Seconds ()),
1323
1337
MaxParts : cfg .maxShards ,
1338
+ OutgoingChanIds : cfg .outgoingChanIDs ,
1339
+ AllowSelfPayment : cfg .allowSelfPayment ,
1324
1340
}
1325
1341
1326
1342
request := & tchrpc.SendPaymentRequest {
@@ -1402,17 +1418,24 @@ func createAndPayNormalInvoiceWithBtc(t *testing.T, src, dst *HarnessNode,
1402
1418
}
1403
1419
1404
1420
func createNormalInvoice (t * testing.T , dst * HarnessNode ,
1405
- amountSat btcutil.Amount ) * lnrpc.AddInvoiceResponse {
1421
+ amountSat btcutil.Amount ,
1422
+ opts ... invoiceOpt ) * lnrpc.AddInvoiceResponse {
1423
+
1424
+ cfg := defaultInvoiceConfig ()
1425
+ for _ , opt := range opts {
1426
+ opt (cfg )
1427
+ }
1406
1428
1407
1429
ctxb := context .Background ()
1408
1430
ctxt , cancel := context .WithTimeout (ctxb , defaultTimeout )
1409
1431
defer cancel ()
1410
1432
1411
1433
expirySeconds := 10
1412
1434
invoiceResp , err := dst .AddInvoice (ctxt , & lnrpc.Invoice {
1413
- Value : int64 (amountSat ),
1414
- Memo : "normal invoice" ,
1415
- Expiry : int64 (expirySeconds ),
1435
+ Value : int64 (amountSat ),
1436
+ Memo : "normal invoice" ,
1437
+ Expiry : int64 (expirySeconds ),
1438
+ RouteHints : cfg .routeHints ,
1416
1439
})
1417
1440
require .NoError (t , err )
1418
1441
@@ -1448,20 +1471,13 @@ func payPayReqWithSatoshi(t *testing.T, payer *HarnessNode, payReq string,
1448
1471
ctxt , cancel := context .WithTimeout (ctxb , defaultTimeout )
1449
1472
defer cancel ()
1450
1473
1451
- shardSize := uint64 (0 )
1452
-
1453
- if cfg .smallShards {
1454
- shardSize = 80_000_000
1455
- }
1456
-
1457
1474
sendReq := & routerrpc.SendPaymentRequest {
1458
1475
PaymentRequest : payReq ,
1459
1476
TimeoutSeconds : int32 (PaymentTimeout .Seconds ()),
1460
1477
FeeLimitMsat : 1_000_000 ,
1461
1478
MaxParts : cfg .maxShards ,
1462
1479
OutgoingChanIds : cfg .outgoingChanIDs ,
1463
1480
AllowSelfPayment : cfg .allowSelfPayment ,
1464
- MaxShardSizeMsat : shardSize ,
1465
1481
}
1466
1482
1467
1483
if cfg .smallShards {
@@ -1652,6 +1668,8 @@ func payInvoiceWithAssets(t *testing.T, payer, rfqPeer *HarnessNode,
1652
1668
FeeLimitMsat : int64 (cfg .feeLimit ),
1653
1669
DestCustomRecords : cfg .destCustomRecords ,
1654
1670
MaxParts : cfg .maxShards ,
1671
+ OutgoingChanIds : cfg .outgoingChanIDs ,
1672
+ AllowSelfPayment : cfg .allowSelfPayment ,
1655
1673
}
1656
1674
1657
1675
if cfg .smallShards {
@@ -1768,6 +1786,12 @@ func withMsatAmount(amt uint64) invoiceOpt {
1768
1786
}
1769
1787
}
1770
1788
1789
+ func withRouteHints (hints []* lnrpc.RouteHint ) invoiceOpt {
1790
+ return func (c * invoiceConfig ) {
1791
+ c .routeHints = hints
1792
+ }
1793
+ }
1794
+
1771
1795
func createAssetInvoice (t * testing.T , dstRfqPeer , dst * HarnessNode ,
1772
1796
assetAmount uint64 , assetID []byte ,
1773
1797
opts ... invoiceOpt ) * lnrpc.AddInvoiceResponse {
@@ -1795,14 +1819,14 @@ func createAssetInvoice(t *testing.T, dstRfqPeer, dst *HarnessNode,
1795
1819
dstTapd := newTapClient (t , dst )
1796
1820
1797
1821
request := & tchrpc.AddInvoiceRequest {
1798
- GroupKey : cfg .groupKey ,
1799
1822
AssetAmount : assetAmount ,
1800
1823
PeerPubkey : peerPubKey ,
1801
1824
InvoiceRequest : & lnrpc.Invoice {
1802
1825
Memo : fmt .Sprintf ("this is an asset invoice for " +
1803
1826
"%d units" , assetAmount ),
1804
- Expiry : timeoutSeconds ,
1805
- ValueMsat : int64 (cfg .msats ),
1827
+ Expiry : timeoutSeconds ,
1828
+ ValueMsat : int64 (cfg .msats ),
1829
+ RouteHints : cfg .routeHints ,
1806
1830
},
1807
1831
}
1808
1832
0 commit comments