mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
Don't return the address of a P2SH of a P2SH (#1455)
This commit is contained in:
parent
b272ae56a6
commit
e99dbe6208
@ -532,7 +532,7 @@ UniValue decodescript(const UniValue& params, bool fHelp)
|
|||||||
" \"address\" (string) dash address\n"
|
" \"address\" (string) dash address\n"
|
||||||
" ,...\n"
|
" ,...\n"
|
||||||
" ],\n"
|
" ],\n"
|
||||||
" \"p2sh\",\"address\" (string) script address\n"
|
" \"p2sh\",\"address\" (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH).\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
"\nExamples:\n"
|
||||||
+ HelpExampleCli("decodescript", "\"hexstring\"")
|
+ HelpExampleCli("decodescript", "\"hexstring\"")
|
||||||
@ -551,7 +551,16 @@ UniValue decodescript(const UniValue& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
ScriptPubKeyToJSON(script, r, false);
|
ScriptPubKeyToJSON(script, r, false);
|
||||||
|
|
||||||
|
UniValue type;
|
||||||
|
|
||||||
|
type = find_value(r, "type");
|
||||||
|
|
||||||
|
if (type.isStr() && type.get_str() != "scripthash") {
|
||||||
|
// P2SH cannot be wrapped in a P2SH. If this script is already a P2SH,
|
||||||
|
// don't return the address for a P2SH of the P2SH.
|
||||||
r.push_back(Pair("p2sh", CBitcoinAddress(CScriptID(script)).ToString()));
|
r.push_back(Pair("p2sh", CBitcoinAddress(CScriptID(script)).ToString()));
|
||||||
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user