Skip to content

Conversation

jl2012
Copy link
Contributor

@jl2012 jl2012 commented Sep 11, 2016

For 0.13.1

createwitnessaddress does not examine script validity in any way and may return unspendable addresses. It should be disabled on mainnet.

In longer term (maybe 0.14), we should disable all the sensitive commands (e.g. dumpprivkey, importprivkey) by default, and only be enabled with a command-line argument

@maflcko maflcko added this to the 0.13.1 milestone Sep 11, 2016
"It returns a json object with the address and witness script.\n"
"WARNING: It does NOT examine validity of the script in any way. Resulting address may be unspendable\n"
"WARNING: Sementics and network rules of witness and non-witness scripts may not be identical.\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

(typo) "Semantics"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, thanks

@btcdrak
Copy link
Contributor

btcdrak commented Sep 12, 2016

utACK 656c2ad

@@ -323,11 +323,13 @@ UniValue createmultisig(const UniValue& params, bool fHelp)

UniValue createwitnessaddress(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 1)
if (fHelp || params.size() < 1 || params.size() > 1 || Params().NetworkIDString() == "main")
Copy link
Member

Choose a reason for hiding this comment

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

Please don't do a string test on the chain params. If you need a specific condition, add a ChainParams::AllowCreateWitness method or so.

Copy link
Member

Choose a reason for hiding this comment

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

Also, is there any need to not just remove the RPC entirely?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just not sure if that's useful for testing. Should we keep it for test only or remove it entirely? I don't have strong opinion.

This RPC command is unsafe as it will return an address even if the script is invalid.
@jl2012 jl2012 changed the title Disable createwitnessaddress in mainnet Remove createwitnessaddress RPC command Sep 13, 2016
@jl2012
Copy link
Contributor Author

jl2012 commented Sep 13, 2016

Revised to simply remove the command

@laanwj
Copy link
Member

laanwj commented Sep 13, 2016

I'm a bit confused by the description. Is this only for 0.13.1? Should this be merged into master/0.14 at all?

It should be disabled on mainnet

Does it have value on testnet/regtest?

@maflcko
Copy link
Member

maflcko commented Sep 13, 2016

@laanwj If this is merged, it is meant for all branches.

@laanwj
Copy link
Member

laanwj commented Sep 13, 2016

So we want that RPC call to disappear forever, not just disable it on mainnet pending segwit rollout?

@jl2012
Copy link
Contributor Author

jl2012 commented Sep 13, 2016

I think it should never be allowed on mainnet. In principle we should not generate any address that may likely be unspendable.

Also, I don't think it's very useful for testing. It is not used by any RPC test, and a witness address could be generated trivially with python.

@laanwj
Copy link
Member

laanwj commented Sep 13, 2016

If it is never useful, sorry to ask, but why did this command make it into a release in the first place?

Edit: obviously ACK on removing it

@sipa
Copy link
Member

sipa commented Sep 13, 2016 via email

@laanwj laanwj merged commit 86c3f8d into bitcoin:master Sep 13, 2016
laanwj added a commit that referenced this pull request Sep 13, 2016
86c3f8d Remove createwitnessaddress (Johnson Lau)
@maflcko maflcko mentioned this pull request Sep 14, 2016
18 tasks
laanwj pushed a commit to laanwj/bitcoin that referenced this pull request Sep 26, 2016
This RPC command is unsafe as it will return an address even if the script is invalid.

Github-Pull: bitcoin#8699
Rebased-From: 86c3f8d
@laanwj
Copy link
Member

laanwj commented Sep 26, 2016

This is backported in #8815, removing tag

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants