@@ -1282,6 +1282,20 @@ func assertChannelAssetBalanceWithDelta(t *testing.T, node *HarnessNode,
12821282 require .InDelta (t , remote , assetBalance .RemoteBalance , delta )
12831283}
12841284
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+
12851299// addRoutingFee adds the default routing fee (1 part per million fee rate plus
12861300// 1000 milli-satoshi base fee) to the given milli-satoshi amount.
12871301func addRoutingFee (amt lnwire.MilliSatoshi ) lnwire.MilliSatoshi {
@@ -1321,6 +1335,8 @@ func sendAssetKeySendPayment(t *testing.T, src, dst *HarnessNode, amt uint64,
13211335 PaymentHash : hash [:],
13221336 TimeoutSeconds : int32 (PaymentTimeout .Seconds ()),
13231337 MaxParts : cfg .maxShards ,
1338+ OutgoingChanIds : cfg .outgoingChanIDs ,
1339+ AllowSelfPayment : cfg .allowSelfPayment ,
13241340 }
13251341
13261342 request := & tchrpc.SendPaymentRequest {
@@ -1402,17 +1418,24 @@ func createAndPayNormalInvoiceWithBtc(t *testing.T, src, dst *HarnessNode,
14021418}
14031419
14041420func 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+ }
14061428
14071429 ctxb := context .Background ()
14081430 ctxt , cancel := context .WithTimeout (ctxb , defaultTimeout )
14091431 defer cancel ()
14101432
14111433 expirySeconds := 10
14121434 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 ,
14161439 })
14171440 require .NoError (t , err )
14181441
@@ -1448,20 +1471,13 @@ func payPayReqWithSatoshi(t *testing.T, payer *HarnessNode, payReq string,
14481471 ctxt , cancel := context .WithTimeout (ctxb , defaultTimeout )
14491472 defer cancel ()
14501473
1451- shardSize := uint64 (0 )
1452-
1453- if cfg .smallShards {
1454- shardSize = 80_000_000
1455- }
1456-
14571474 sendReq := & routerrpc.SendPaymentRequest {
14581475 PaymentRequest : payReq ,
14591476 TimeoutSeconds : int32 (PaymentTimeout .Seconds ()),
14601477 FeeLimitMsat : 1_000_000 ,
14611478 MaxParts : cfg .maxShards ,
14621479 OutgoingChanIds : cfg .outgoingChanIDs ,
14631480 AllowSelfPayment : cfg .allowSelfPayment ,
1464- MaxShardSizeMsat : shardSize ,
14651481 }
14661482
14671483 if cfg .smallShards {
@@ -1652,6 +1668,8 @@ func payInvoiceWithAssets(t *testing.T, payer, rfqPeer *HarnessNode,
16521668 FeeLimitMsat : int64 (cfg .feeLimit ),
16531669 DestCustomRecords : cfg .destCustomRecords ,
16541670 MaxParts : cfg .maxShards ,
1671+ OutgoingChanIds : cfg .outgoingChanIDs ,
1672+ AllowSelfPayment : cfg .allowSelfPayment ,
16551673 }
16561674
16571675 if cfg .smallShards {
@@ -1768,6 +1786,12 @@ func withMsatAmount(amt uint64) invoiceOpt {
17681786 }
17691787}
17701788
1789+ func withRouteHints (hints []* lnrpc.RouteHint ) invoiceOpt {
1790+ return func (c * invoiceConfig ) {
1791+ c .routeHints = hints
1792+ }
1793+ }
1794+
17711795func createAssetInvoice (t * testing.T , dstRfqPeer , dst * HarnessNode ,
17721796 assetAmount uint64 , assetID []byte ,
17731797 opts ... invoiceOpt ) * lnrpc.AddInvoiceResponse {
@@ -1795,14 +1819,14 @@ func createAssetInvoice(t *testing.T, dstRfqPeer, dst *HarnessNode,
17951819 dstTapd := newTapClient (t , dst )
17961820
17971821 request := & tchrpc.AddInvoiceRequest {
1798- GroupKey : cfg .groupKey ,
17991822 AssetAmount : assetAmount ,
18001823 PeerPubkey : peerPubKey ,
18011824 InvoiceRequest : & lnrpc.Invoice {
18021825 Memo : fmt .Sprintf ("this is an asset invoice for " +
18031826 "%d units" , assetAmount ),
1804- Expiry : timeoutSeconds ,
1805- ValueMsat : int64 (cfg .msats ),
1827+ Expiry : timeoutSeconds ,
1828+ ValueMsat : int64 (cfg .msats ),
1829+ RouteHints : cfg .routeHints ,
18061830 },
18071831 }
18081832
0 commit comments