New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wallet] [rpc] sendtoaddress/sendmany: Add explicit feerate option #11413

Open
wants to merge 5 commits into
base: master
from

Conversation

Projects
None yet
@kallewoof
Member

kallewoof commented Sep 28, 2017

This lets users pick their own fees when using sendtoaddress if they prefer this over the estimators.

@jonasschnelli

This comment has been minimized.

Member

jonasschnelli commented Sep 28, 2017

Not opposed to add that. Though IMO the more experience users (which are those who may use explicit fee-rates) should use create/fund/sendrawtx.

Concept ACK

@promag

Please add tests.

@@ -54,6 +54,7 @@ bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_esti
{"UNSET", FeeEstimateMode::UNSET},
{"ECONOMICAL", FeeEstimateMode::ECONOMICAL},
{"CONSERVATIVE", FeeEstimateMode::CONSERVATIVE},
{"EXPLICIT", FeeEstimateMode::EXPLICIT},

This comment has been minimized.

@promag

promag Sep 28, 2017

Member

The intent sounds more like no estimation so {"NONE", FeeEstimateMode::NONE}?

This comment has been minimized.

@kallewoof

kallewoof Sep 29, 2017

Member

I don't know. People could mistake that to mean "no fee".

@@ -445,12 +445,15 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
" \"UNSET\"\n"
" \"ECONOMICAL\"\n"
" \"CONSERVATIVE\"\n"
" \"EXPLICIT\"\n"
"9. feerate (numeric, optional) Fee rate (sat/kb) to use for EXPLICIT mode.\n"

This comment has been minimized.

@promag

promag Sep 28, 2017

Member

Mention that estimate_mode must be set to (currenlty) EXPLICIT to use this value?

This comment has been minimized.

@kallewoof

kallewoof Sep 29, 2017

Member

to use for EXPLICIT mode is not enough?

@@ -494,6 +497,12 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
}
}
if (!request.params[8].isNull()) {
if (coin_control.m_fee_mode != FeeEstimateMode::EXPLICIT) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Explicit fee rate can only be used when estimate mode is set to EXPLICIT");

This comment has been minimized.

@promag

promag Sep 28, 2017

Member

Add test for error.

@esotericnonsense

This comment has been minimized.

Contributor

esotericnonsense commented Sep 28, 2017

Concept ACK. I don't like that this results in sendtoaddress having 8 parameters but I don't see an immediately obvious way to avoid that.

Sendmany could get it too?

@kallewoof

This comment has been minimized.

Member

kallewoof commented Sep 29, 2017

Can't fix people putting too high fees in, but if they put too low, they should be able to bump the fee unless they specifically disable it. As such, RBF is default-on when fees are explicit (3d14d35).

@promag Added tests (1768936).

@esotericnonsense I don't know how frequently this will be used. I suggest it for sendtoaddress because I see a lot of people asking how to fire off a tx with a given fee. There's also settxfee.

@MeshCollider

This comment has been minimized.

Member

MeshCollider commented Sep 29, 2017

Re: the 8 parameter issue @esotericnonsense mentioned, it would be cleaner to convert most parameters to a JSON object input like bumpfee, listunspent, etc. use since most are independent of each other and optional

@@ -39,6 +39,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "sendtoaddress", 4, "subtractfeefromamount" },
{ "sendtoaddress", 5 , "replaceable" },
{ "sendtoaddress", 6 , "conf_target" },
{ "sendtoaddress", 8, "feerate"},

This comment has been minimized.

@kallewoof

kallewoof Oct 1, 2017

Member

Self-nit: space after "feerate"

@luke-jr

luke-jr suggested changes Nov 10, 2017 edited

Concept ACK, but sendmany should get it too.

@@ -445,12 +445,15 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
" \"UNSET\"\n"
" \"ECONOMICAL\"\n"
" \"CONSERVATIVE\"\n"
" \"EXPLICIT\"\n"
"9. feerate (numeric, optional) Fee rate (sat/kb) to use for EXPLICIT mode. (Note: replaceable defaults to true when used)\n"

This comment has been minimized.

@luke-jr

luke-jr Nov 10, 2017

Member

This isn't in the argument list above.

@@ -494,6 +497,14 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
}
}
if (!request.params[8].isNull()) {

This comment has been minimized.

@luke-jr

luke-jr Nov 10, 2017

Member

It doesn't make sense to add a new param for this. Instead, make params[6] be conf target or feerate...

@kallewoof

This comment has been minimized.

Member

kallewoof commented Nov 13, 2017

Addressed @luke-jr requests (double-use conf_target and add feature to sendmany).

@kallewoof kallewoof changed the title from [wallet] [rpc] sendtoaddress: Add explicit feerate option to sendtoaddress to [wallet] [rpc] sendtoaddress/sendmany: Add explicit feerate option Dec 21, 2017

@DrahtBot DrahtBot referenced this pull request Aug 22, 2018

Merged

Remove accounts rpcs #14023

@DrahtBot DrahtBot removed the Needs rebase label Sep 10, 2018

@DrahtBot

This comment has been minimized.

Contributor

DrahtBot commented Sep 21, 2018

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #10973 (Refactor: separate wallet from node by ryanofsky)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@sipa

This comment has been minimized.

Member

sipa commented Nov 11, 2018

Concept ACK

@MeshCollider

This comment has been minimized.

Member

MeshCollider commented Nov 11, 2018

utACK d9b1c42, my earlier concern about adding another parameter is no longer relevant :)

@@ -355,17 +355,20 @@ static UniValue sendtoaddress(const JSONRPCRequest& request)
"5. subtractfeefromamount (boolean, optional, default=false) The fee will be deducted from the amount being sent.\n"
" The recipient will receive less bitcoins than you enter in the amount field.\n"
"6. replaceable (boolean, optional) Allow this transaction to be replaced by a transaction with higher fees via BIP 125\n"
"7. conf_target (numeric, optional) Confirmation target (in blocks)\n"
" Defaults to false unless explicit estimate mode is used, in which case it defaults to true\n"
"7. conf_target (numeric, optional) Confirmation target (in blocks), or fee rate (sat/kb) if explicit estimate mode is used\n"

This comment has been minimized.

@MarcoFalke

MarcoFalke Nov 11, 2018

Member

Fee rates are passed in as BTC/kB (see settxfee for example) and amounts can be passed in as either num or string.

This comment has been minimized.

@kallewoof
@promag

utACK, needs squash and could add release notes.

@@ -0,0 +1,5 @@
Low-level RPC changes

This comment has been minimized.

@promag

promag Nov 12, 2018

Member

nit, I may be wrong but I think you could increment doc/release-notes-14454.md?

This comment has been minimized.

@kallewoof

kallewoof Nov 12, 2018

Member

Hm. Does it matter? I assume the files are merged together at the end anyway.

@kallewoof

This comment has been minimized.

Member

kallewoof commented Nov 12, 2018

@promag Added release notes & squashed. Also fixed sendmany, which I had forgotten.

kallewoof added some commits Sep 28, 2017

rpc/wallet/sendtoaddress: Add an EXPLICIT mode to estimate_mode and a…
… feerate optional to explicitly specify the feerate of the transaction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment