cmd: EstimateFee for explicit inputs

This commit is contained in:
Slyghtning committed 2026-01-07 10:25:30 +01:00
1 parent 280929ba1e
commit 44aa5efc66
1 file changed
+19
+19
View File
@@ -402,6 +402,14 @@ var estimateFeeCommand = cli.Command{
"transaction *should* confirm in",
},
coinSelectionStrategyFlag,
cli.StringSliceFlag{
Name: "utxo",
Usage: "a utxo specified as outpoint(tx:idx) which " +
"will be used as input for the transaction " +
"to be estimated. This flag can be " +
"repeatedly used to specify multiple utxos " +
"as inputs.",
},
},
Action: actionDecorator(estimateFees),
}
@@ -423,10 +431,21 @@ func estimateFees(ctx *cli.Context) error {
client, cleanUp := getClient(ctx)
defer cleanUp()
var inputs []*lnrpc.OutPoint
if ctx.IsSet("utxo") {
utxos := ctx.StringSlice("utxo")
inputs, err = lnd.UtxosToOutpoints(utxos)
if err != nil {
return fmt.Errorf("unable to decode utxos: %w", err)
}
}
resp, err := client.EstimateFee(ctxc, &lnrpc.EstimateFeeRequest{
AddrToAmount: amountToAddr,
TargetConf: int32(ctx.Int64("conf_target")),
CoinSelectionStrategy: coinSelectionStrategy,
Inputs: inputs,
})
if err != nil {
return err