-
Notifications
You must be signed in to change notification settings - Fork 37.8k
wallet: Deprecate addwitnessaddress #12210
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: Deprecate addwitnessaddress #12210
Conversation
src/wallet/rpcwallet.cpp
Outdated
@@ -1285,7 +1285,8 @@ UniValue addwitnessaddress(const JSONRPCRequest& request) | |||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) | |||
{ | |||
std::string msg = "addwitnessaddress \"address\" ( p2sh )\n" | |||
"\nAdd a witness address for a script (with pubkey or redeemscript known). Requires a new wallet backup.\n" | |||
"\nDEPRECATED: use option -addresstype=[bech32|p2sh-segwit] instead.\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to suggest using the RPC parameters, rather than changing the config file and restarting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah getnewaddress
with the address_type
parameter more closely resembles what this RPC was used for IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
best to document both, I'll mention that option as well.
src/wallet/rpcwallet.cpp
Outdated
@@ -1285,7 +1285,8 @@ UniValue addwitnessaddress(const JSONRPCRequest& request) | |||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) | |||
{ | |||
std::string msg = "addwitnessaddress \"address\" ( p2sh )\n" | |||
"\nAdd a witness address for a script (with pubkey or redeemscript known). Requires a new wallet backup.\n" | |||
"\nDEPRECATED: use option -addresstype=[bech32|p2sh-segwit] instead.\n" | |||
"Add a witness address for a script (with pubkey or redeemscript known). Requires a new wallet backup.\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't require a new wallet backup anymore, IIRC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it makes sense to update the documentation of a deprecated call, besides adding a DEPRECATED message and hiding it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, its not like backing up would actually be a bad thing anyway
utACK |
utACK, thanks! |
src/wallet/rpcwallet.cpp
Outdated
@@ -1299,6 +1300,12 @@ UniValue addwitnessaddress(const JSONRPCRequest& request) | |||
throw std::runtime_error(msg); | |||
} | |||
|
|||
if (!IsDeprecatedRPCEnabled("addwitnessaddress")) { | |||
throw JSONRPCError(RPC_METHOD_DEPRECATED, "addwitnessaddress is deprecated and will be fully removed in v0.17. " | |||
"To use estimatefee in v0.16, restart bitcoind with -deprecatedrpc=estimatefee.\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still mentions estimatefee :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, if you deprecate it like this you'll have to add -deprecatedrpc=addwitnessaddress to the tests which use it (easier than reworking the tests at the same time)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gah, will update. Nothing is ever easy, is it? I assumed I was just updating the documentation hence I didn't bother running any tests.
Concept ACK |
The following tests are failing due to to the deprecation:
I'm starting to think this was a kind of bad idea, if we still rely so much on that call. |
We can fix the test, but lets move the deprecation to 0.17 to not block 0.16? |
I don't think anything needs to be blocked on that, just adding |
src/wallet/rpcwallet.cpp
Outdated
@@ -1299,6 +1300,12 @@ UniValue addwitnessaddress(const JSONRPCRequest& request) | |||
throw std::runtime_error(msg); | |||
} | |||
|
|||
if (!IsDeprecatedRPCEnabled("addwitnessaddress")) { | |||
throw JSONRPCError(RPC_METHOD_DEPRECATED, "addwitnessaddress is deprecated and will be fully removed in v0.17. " | |||
"To use addwitnessaddress in v0.16, restart bitcoind with -deprecatedrpc=estimatefee.\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should say -deprecatedrpc=addwitnessaddress
instead of -deprecatedrpc=estimatefee
utACK modulo flack's comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 117ee54aa62ddb43f039797d5496e014553f28ec with estimatefee fix and squash commits squashed (obviously)
utACK after comments. We can slowly remove |
Now that segwit is natively supported by the wallet, deprecate the hack `addwitnessaddress`.
e849ae0
to
cdf3e03
Compare
cdf3e03 wallet: Deprecate addwitnessaddress (Wladimir J. van der Laan) Pull request description: Now that segwit is natively supported by the wallet, deprecate the hack `addwitnessaddress`. Tree-SHA512: f33b1c33d200fa8f1a0fba424b30e9c2a78147cde8bb0a3fd41194b77980454cddfb23da256cd6fe78726e87161deaa23357d0764e74c3eb83177cc518afa49c
f523c6b [qa] Use address type in addmultisigaddress to avoid addwitnessaddress (João Barbosa) 886a92f [rpc] Add address type option to addmultisigaddress (João Barbosa) Pull request description: Adds the option `address_type` to `addmultisigaddress` and `createmultisg` RPC. This also allows to avoid `addwitnessaddress` to obtain an `p2sh-segwit` or `bech32` multsig address. Related to #12210 as this reduces `addwitnessaddress` usage. Tree-SHA512: 8f8f85dfcff66bb6c7e1e9865e37c285dead1d6dadb9672a89b92fa209d03cc35817ca1d656588c6c2146b728daaf7540b851929b640294653c62836cbefe7ee
Now that segwit is natively supported by the wallet, deprecate the hack
addwitnessaddress
.