mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
rpc: bugfix, incorrect segwit redeem script size used in signrawtransactionwithkey
The process currently fails to sign redeem scripts that are longer than 520 bytes. Even when it shouldn't. The 520 bytes redeem scripts limit is a legacy p2sh rule, and not a segwit limitation. Segwit redeem scripts are not restricted by the script item size limit. The reason why this occurs, is the usage of the same keystore used by the legacy spkm. Which contains blockage for any redeem scripts longer than the script item size limit.
This commit is contained in:
parent
0c9fedfc45
commit
9d9a91c4ea
3 changed files with 11 additions and 7 deletions
|
|
@ -785,7 +785,7 @@ static RPCHelpMan signrawtransactionwithkey()
|
|||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed. Make sure the tx has at least one input.");
|
||||
}
|
||||
|
||||
FillableSigningProvider keystore;
|
||||
FlatSigningProvider keystore;
|
||||
const UniValue& keys = request.params[1].get_array();
|
||||
for (unsigned int idx = 0; idx < keys.size(); ++idx) {
|
||||
UniValue k = keys[idx];
|
||||
|
|
@ -793,7 +793,11 @@ static RPCHelpMan signrawtransactionwithkey()
|
|||
if (!key.IsValid()) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key");
|
||||
}
|
||||
keystore.AddKey(key);
|
||||
|
||||
CPubKey pubkey = key.GetPubKey();
|
||||
CKeyID key_id = pubkey.GetID();
|
||||
keystore.pubkeys.emplace(key_id, pubkey);
|
||||
keystore.keys.emplace(key_id, key);
|
||||
}
|
||||
|
||||
// Fetch previous transactions (inputs):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue