@@ -182,6 +182,15 @@ var (
182182 "set if there are multiple channels with the same " +
183183 "asset ID present" ,
184184 }
185+
186+ allowUnEconomicalFlag = cli.BoolFlag {
187+ Name : "allow_uneconomical" ,
188+ Usage : "allow sending asset payments that are uneconomical " +
189+ "because the required non-dust amount for an asset " +
190+ "carrier HTLC plus one asset unit is higher than the " +
191+ "total invoice/payment amount that arrives at the " +
192+ "destination" ,
193+ }
185194)
186195
187196// resultStreamWrapper is a wrapper around the SendPaymentClient stream that
@@ -275,7 +284,7 @@ var sendPaymentCommand = cli.Command{
275284 "--asset_amount=Y [--rfq_peer_pubkey=Z]" ,
276285 Flags : append (
277286 commands .SendPaymentCommand .Flags , assetIDFlag , assetAmountFlag ,
278- rfqPeerPubKeyFlag ,
287+ rfqPeerPubKeyFlag , allowUnEconomicalFlag ,
279288 ),
280289 Action : sendPayment ,
281290}
@@ -376,6 +385,7 @@ func sendPayment(ctx *cli.Context) error {
376385 rHash = hash [:]
377386
378387 req .PaymentHash = rHash
388+ allowUnEconomical := ctx .Bool (allowUnEconomicalFlag .Name )
379389
380390 return commands .SendPaymentRequest (
381391 ctx , req , lndConn , tapdConn , func (ctx context.Context ,
@@ -389,10 +399,11 @@ func sendPayment(ctx *cli.Context) error {
389399
390400 stream , err := tchrpcClient .SendPayment (
391401 ctx , & tchrpc.SendPaymentRequest {
392- AssetId : assetIDBytes ,
393- AssetAmount : assetAmountToSend ,
394- PeerPubkey : rfqPeerKey ,
395- PaymentRequest : req ,
402+ AssetId : assetIDBytes ,
403+ AssetAmount : assetAmountToSend ,
404+ PeerPubkey : rfqPeerKey ,
405+ PaymentRequest : req ,
406+ AllowUneconomical : allowUnEconomical ,
396407 },
397408 )
398409 if err != nil {
@@ -424,6 +435,7 @@ var payInvoiceCommand = cli.Command{
424435 },
425436 assetIDFlag ,
426437 rfqPeerPubKeyFlag ,
438+ allowUnEconomicalFlag ,
427439 ),
428440 Action : payInvoice ,
429441}
@@ -468,15 +480,13 @@ func payInvoice(ctx *cli.Context) error {
468480 return fmt .Errorf ("unable to decode assetID: %v" , err )
469481 }
470482
471- var assetID asset.ID
472- copy (assetID [:], assetIDBytes )
473-
474483 rfqPeerKey , err := hex .DecodeString (ctx .String (rfqPeerPubKeyFlag .Name ))
475484 if err != nil {
476485 return fmt .Errorf ("unable to decode RFQ peer public key: " +
477486 "%w" , err )
478487 }
479488
489+ allowUnEconomical := ctx .Bool (allowUnEconomicalFlag .Name )
480490 req := & routerrpc.SendPaymentRequest {
481491 PaymentRequest : commands .StripPrefix (payReq ),
482492 }
@@ -493,9 +503,10 @@ func payInvoice(ctx *cli.Context) error {
493503
494504 stream , err := tchrpcClient .SendPayment (
495505 ctx , & tchrpc.SendPaymentRequest {
496- AssetId : assetIDBytes ,
497- PeerPubkey : rfqPeerKey ,
498- PaymentRequest : req ,
506+ AssetId : assetIDBytes ,
507+ PeerPubkey : rfqPeerKey ,
508+ PaymentRequest : req ,
509+ AllowUneconomical : allowUnEconomical ,
499510 },
500511 )
501512 if err != nil {
0 commit comments