Skip to content

Commit

Permalink
wallet: fix SetFeeEstimateMode() error message
Browse files Browse the repository at this point in the history
to clarify for the user the confusing error message that the missing fee rate
needs to be set in the conf_target param/option.
  • Loading branch information
jonatack committed Oct 24, 2020
1 parent 052427e commit fc57217
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ static void SetFeeEstimateMode(const CWallet* pwallet, CCoinControl& cc, const U

if (cc.m_fee_mode == FeeEstimateMode::BTC_KB || cc.m_fee_mode == FeeEstimateMode::SAT_B) {
if (estimate_param.isNull()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Selected estimate_mode requires a fee rate");
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Selected estimate_mode %s requires a fee rate to be specified in conf_target", estimate_mode.get_str()));
}

CAmount fee_rate = AmountFromValue(estimate_param);
Expand Down
8 changes: 4 additions & 4 deletions test/functional/wallet_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def run_test(self):

# Sendmany with explicit fee (BTC/kB)
# Throw if no conf_target provided
assert_raises_rpc_error(-8, "Selected estimate_mode requires a fee rate",
assert_raises_rpc_error(-8, "Selected estimate_mode bTc/kB requires a fee rate to be specified in conf_target",
self.nodes[2].sendmany,
amounts={ address: 10 },
estimate_mode='bTc/kB')
Expand All @@ -254,7 +254,7 @@ def run_test(self):

# Sendmany with explicit fee (SAT/B)
# Throw if no conf_target provided
assert_raises_rpc_error(-8, "Selected estimate_mode requires a fee rate",
assert_raises_rpc_error(-8, "Selected estimate_mode sat/b requires a fee rate to be specified in conf_target",
self.nodes[2].sendmany,
amounts={ address: 10 },
estimate_mode='sat/b')
Expand Down Expand Up @@ -421,7 +421,7 @@ def run_test(self):
assert prebalance > 2
address = self.nodes[1].getnewaddress()
# Throw if no conf_target provided
assert_raises_rpc_error(-8, "Selected estimate_mode requires a fee rate",
assert_raises_rpc_error(-8, "Selected estimate_mode BTc/Kb requires a fee rate to be specified in conf_target",
self.nodes[2].sendtoaddress,
address=address,
amount=1.0,
Expand Down Expand Up @@ -455,7 +455,7 @@ def run_test(self):
assert prebalance > 2
address = self.nodes[1].getnewaddress()
# Throw if no conf_target provided
assert_raises_rpc_error(-8, "Selected estimate_mode requires a fee rate",
assert_raises_rpc_error(-8, "Selected estimate_mode SAT/b requires a fee rate to be specified in conf_target",
self.nodes[2].sendtoaddress,
address=address,
amount=1.0,
Expand Down

0 comments on commit fc57217

Please sign in to comment.