@@ -402,6 +402,14 @@ var estimateFeeCommand = cli.Command{
402402 "transaction *should* confirm in" ,
403403 },
404404 coinSelectionStrategyFlag ,
405+ cli.StringSliceFlag {
406+ Name : "utxo" ,
407+ Usage : "a utxo specified as outpoint(tx:idx) which " +
408+ "will be used as input for the transaction " +
409+ "to be estimated. This flag can be " +
410+ "repeatedly used to specify multiple utxos " +
411+ "as inputs." ,
412+ },
405413 },
406414 Action : actionDecorator (estimateFees ),
407415}
@@ -423,10 +431,21 @@ func estimateFees(ctx *cli.Context) error {
423431 client , cleanUp := getClient (ctx )
424432 defer cleanUp ()
425433
434+ var inputs []* lnrpc.OutPoint
435+ if ctx .IsSet ("utxo" ) {
436+ utxos := ctx .StringSlice ("utxo" )
437+
438+ inputs , err = lnd .UtxosToOutpoints (utxos )
439+ if err != nil {
440+ return fmt .Errorf ("unable to decode utxos: %w" , err )
441+ }
442+ }
443+
426444 resp , err := client .EstimateFee (ctxc , & lnrpc.EstimateFeeRequest {
427445 AddrToAmount : amountToAddr ,
428446 TargetConf : int32 (ctx .Int64 ("conf_target" )),
429447 CoinSelectionStrategy : coinSelectionStrategy ,
448+ Inputs : inputs ,
430449 })
431450 if err != nil {
432451 return err
@@ -607,7 +626,7 @@ func sendCoins(ctx *cli.Context) error {
607626 if ctx .IsSet ("utxo" ) {
608627 utxos := ctx .StringSlice ("utxo" )
609628
610- outpoints , err = UtxosToOutpoints (utxos )
629+ outpoints , err = lnd . UtxosToOutpoints (utxos )
611630 if err != nil {
612631 return fmt .Errorf ("unable to decode utxos: %w" , err )
613632 }
@@ -784,12 +803,12 @@ func listUnspent(ctx *cli.Context) error {
784803 // to stdout. At the moment, this filters out the raw txid bytes from
785804 // each utxo's outpoint and only prints the txid string.
786805 var listUnspentResp = struct {
787- Utxos []* Utxo `json:"utxos"`
806+ Utxos []* lnd. Utxo `json:"utxos"`
788807 }{
789- Utxos : make ([]* Utxo , 0 , len (resp .Utxos )),
808+ Utxos : make ([]* lnd. Utxo , 0 , len (resp .Utxos )),
790809 }
791810 for _ , protoUtxo := range resp .Utxos {
792- utxo := NewUtxoFromProto (protoUtxo )
811+ utxo := lnd . NewUtxoFromProto (protoUtxo )
793812 listUnspentResp .Utxos = append (listUnspentResp .Utxos , utxo )
794813 }
795814
@@ -2789,12 +2808,14 @@ func updateChannelPolicy(ctx *cli.Context) error {
27892808 // to stdout. At the moment, this filters out the raw txid bytes from
27902809 // each failed update's outpoint and only prints the txid string.
27912810 var listFailedUpdateResp = struct {
2792- FailedUpdates []* FailedUpdate `json:"failed_updates"`
2811+ FailedUpdates []* lnd. FailedUpdate `json:"failed_updates"`
27932812 }{
2794- FailedUpdates : make ([]* FailedUpdate , 0 , len (resp .FailedUpdates )),
2813+ FailedUpdates : make (
2814+ []* lnd.FailedUpdate , 0 , len (resp .FailedUpdates ),
2815+ ),
27952816 }
27962817 for _ , protoUpdate := range resp .FailedUpdates {
2797- failedUpdate := NewFailedUpdateFromProto (protoUpdate )
2818+ failedUpdate := lnd . NewFailedUpdateFromProto (protoUpdate )
27982819 listFailedUpdateResp .FailedUpdates = append (
27992820 listFailedUpdateResp .FailedUpdates , failedUpdate )
28002821 }
0 commit comments