Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction_util.cpp
Show First 20 Lines • Show All 248 Lines • ▼ Show 20 Lines | if (!prevTxsUnival.isNull()) { | ||||
CScript redeemScript(rsData.begin(), rsData.end()); | CScript redeemScript(rsData.begin(), rsData.end()); | ||||
keystore->AddCScript(redeemScript); | keystore->AddCScript(redeemScript); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
UniValue SignTransaction(CMutableTransaction &mtx, | void SignTransaction(CMutableTransaction &mtx, const SigningProvider *keystore, | ||||
const SigningProvider *keystore, | std::map<COutPoint, Coin> &coins, const UniValue &hashType, | ||||
std::map<COutPoint, Coin> &coins, | UniValue &result) { | ||||
const UniValue &hashType) { | |||||
SigHashType sigHashType = ParseSighashString(hashType); | SigHashType sigHashType = ParseSighashString(hashType); | ||||
if (!sigHashType.hasForkId()) { | if (!sigHashType.hasForkId()) { | ||||
throw JSONRPCError(RPC_INVALID_PARAMETER, | throw JSONRPCError(RPC_INVALID_PARAMETER, | ||||
"Signature must use SIGHASH_FORKID"); | "Signature must use SIGHASH_FORKID"); | ||||
} | } | ||||
// Script verification errors. | // Script verification errors. | ||||
UniValue vErrors(UniValue::VARR); | UniValue vErrors(UniValue::VARR); | ||||
Show All 39 Lines | for (size_t i = 0; i < mtx.vin.size(); i++) { | ||||
} else { | } else { | ||||
TxInErrorToJSON(txin, vErrors, ScriptErrorString(serror)); | TxInErrorToJSON(txin, vErrors, ScriptErrorString(serror)); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
bool fComplete = vErrors.empty(); | bool fComplete = vErrors.empty(); | ||||
UniValue result(UniValue::VOBJ); | |||||
result.pushKV("hex", EncodeHexTx(CTransaction(mtx))); | result.pushKV("hex", EncodeHexTx(CTransaction(mtx))); | ||||
result.pushKV("complete", fComplete); | result.pushKV("complete", fComplete); | ||||
if (!vErrors.empty()) { | if (!vErrors.empty()) { | ||||
if (result.exists("errors")) { | |||||
vErrors.push_backV(result["errors"].getValues()); | |||||
} | |||||
result.pushKV("errors", vErrors); | result.pushKV("errors", vErrors); | ||||
} | } | ||||
return result; | |||||
} | } |