Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cmd/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,11 @@ var estimateFeeCommand = cli.Command{
'{"ExampleAddr": NumCoinsInSatoshis, "SecondAddr": NumCoins}'
`,
Flags: []cli.Flag{
cli.Int64Flag{
cli.Uint64Flag{
Name: "conf_target",
Usage: "(optional) the number of blocks that the " +
"transaction *should* confirm in",
Usage: "the number of blocks that the transaction " +
"should be confirmed on-chain within",
Value: 6,
},
Comment on lines +399 to 404

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While changing the flag type to Uint64Flag is a good improvement for conf_target, the code that reads this flag's value in the estimateFees function was not updated to match. It still uses ctx.Int64("conf_target") at line 429.

Although this might work due to implicit type casting in the underlying library, it's best practice to use the corresponding ctx.Uint64() function to read a Uint64Flag value. This ensures type safety, improves code clarity, and avoids reliance on third-party library implementation details that might change in the future. Other parts of the codebase already follow this pattern (e.g., for the min_confs flag).

In the estimateFees function, please update the following line:

// line 429
TargetConf: int32(ctx.Int64("conf_target")),

to:

TargetConf: int32(ctx.Uint64("conf_target")),

coinSelectionStrategyFlag,
},
Expand Down