Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Don't return the address of a P2SH of a P2SH #8845
Conversation
MarcoFalke
added
the
RPC/REST/ZMQ
label
Sep 29, 2016
| + UniValue type; | ||
| + type = find_value(r, "type"); | ||
| + | ||
| + if ((!type.isNull()) && (type.isStr()) && (type.get_str() != "scripthash")) |
ryanofsky
Oct 3, 2016
Contributor
Should probably drop the isNull check because a value can't be both a string and a null at the same time.
Also maybe drop the parens around && conditions (searching for "&&" in this file shows no parens used in the other cases).
|
@ryanofsky's suggestions added and rebased. |
|
utACK |
|
"Incorporated suggested changes from @ryanofsky." doesn't belong in the commit description (it will ping him every time the commit goes somewhere..) |
|
Agree. Also please don't put irrelevant information in the commit subject line. |
|
Fixed commit description. |
|
utACK |
| + UniValue type; | ||
| + type = find_value(r, "type"); | ||
| + | ||
| + if (type.isStr() && type.get_str() != "scripthash") { |
laanwj
Oct 11, 2016
Owner
I think looking at the generated JSON here instead of the script object itself is a bit confusing, but I tend to agree it's the best way to go here to not have to repeat ExtractDestinations.
jnewbery commentedSep 29, 2016
be066fa added an RPC to decode a hex input script. The returned object is:
That "p2sh" return value is the address of a P2SH with the hex input script as the redeem script.
If the input script is already a P2SH script, this doesn't make sense (we can't wrap a P2SH in a P2SH). Only return a P2SH address if the input script is not a P2SH script.