Merge #12427: Make signrawtransaction accept P2SH-P2WSH redeemscripts

5f605e1 Make signrawtransaction accept P2SH-P2WSH redeemscripts (Pieter Wuille)

Pull request description:

  This is a quick fix for #12418, which is a regression in 0.16.

  It permits specifying just the inner redeemscript to let `signrawtransaction` succeed. This inner redeemscript is already reported by `addmultisigaddress` & co.

  #11708 uses a different approach, where `listunspent` reports both inner & outer redeemscript, but requires both to be provided to `signrawtransaction`. Part of #11708 is still needed even in combination with this PR however, as currently the inner redeemscript isn't reported by `listunspent`.

Tree-SHA512: a6fa2b2661ce04db25cf029dd31da39c0b4811d43692f816dfe0f77b4159b5e2952051664356a579f690ccd58a626e0975708afcd7ad5919366c490944e3a9a5
This commit is contained in:
Wladimir J. van der Laan 2018-02-15 22:22:59 +01:00
commit 3fa556aee2
No known key found for this signature in database
GPG key ID: 1E4AED62986CD25D

View file

@ -848,6 +848,8 @@ UniValue signrawtransaction(const JSONRPCRequest& request)
std::vector<unsigned char> rsData(ParseHexV(v, "redeemScript")); std::vector<unsigned char> rsData(ParseHexV(v, "redeemScript"));
CScript redeemScript(rsData.begin(), rsData.end()); CScript redeemScript(rsData.begin(), rsData.end());
tempKeystore.AddCScript(redeemScript); tempKeystore.AddCScript(redeemScript);
// Automatically also add the P2WSH wrapped version of the script (to deal with P2SH-P2WSH).
tempKeystore.AddCScript(GetScriptForWitness(redeemScript));
} }
} }
} }