mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
rpc: Properly deserialize txs with witness before signing
This commit is contained in:
parent
baf9cedee8
commit
cccc752569
@ -644,7 +644,7 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request)
|
|||||||
std::vector<CMutableTransaction> txVariants(txs.size());
|
std::vector<CMutableTransaction> txVariants(txs.size());
|
||||||
|
|
||||||
for (unsigned int idx = 0; idx < txs.size(); idx++) {
|
for (unsigned int idx = 0; idx < txs.size(); idx++) {
|
||||||
if (!DecodeHexTx(txVariants[idx], txs[idx].get_str(), true)) {
|
if (!DecodeHexTx(txVariants[idx], txs[idx].get_str())) {
|
||||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, strprintf("TX decode failed for tx %d", idx));
|
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, strprintf("TX decode failed for tx %d", idx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -766,7 +766,7 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
|
|||||||
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR, UniValue::VARR, UniValue::VSTR}, true);
|
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR, UniValue::VARR, UniValue::VSTR}, true);
|
||||||
|
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
if (!DecodeHexTx(mtx, request.params[0].get_str(), true)) {
|
if (!DecodeHexTx(mtx, request.params[0].get_str())) {
|
||||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
|
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3229,7 +3229,7 @@ UniValue signrawtransactionwithwallet(const JSONRPCRequest& request)
|
|||||||
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR, UniValue::VSTR}, true);
|
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR, UniValue::VSTR}, true);
|
||||||
|
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
if (!DecodeHexTx(mtx, request.params[0].get_str(), true)) {
|
if (!DecodeHexTx(mtx, request.params[0].get_str())) {
|
||||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
|
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user