Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction_util.cpp
Show First 20 Lines • Show All 211 Lines • ▼ Show 20 Lines | if (!prevTxsUnival.isNull()) { | ||||
err = err + | err = err + | ||||
ScriptToAsmStr(coin->second.GetTxOut().scriptPubKey) + | ScriptToAsmStr(coin->second.GetTxOut().scriptPubKey) + | ||||
"\nvs:\n" + ScriptToAsmStr(scriptPubKey); | "\nvs:\n" + ScriptToAsmStr(scriptPubKey); | ||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, err); | throw JSONRPCError(RPC_DESERIALIZATION_ERROR, err); | ||||
} | } | ||||
CTxOut txout; | CTxOut txout; | ||||
txout.scriptPubKey = scriptPubKey; | txout.scriptPubKey = scriptPubKey; | ||||
txout.nValue = Amount::zero(); | txout.nValue = MAX_MONEY; | ||||
if (prevOut.exists("amount")) { | if (prevOut.exists("amount")) { | ||||
txout.nValue = | txout.nValue = | ||||
AmountFromValue(find_value(prevOut, "amount")); | AmountFromValue(find_value(prevOut, "amount")); | ||||
} else { | } else { | ||||
// amount param is required in replay-protected txs. | // amount param is required in replay-protected txs. | ||||
// Note that we must check for its presence here rather | // Note that we must check for its presence here rather | ||||
// than use RPCTypeCheckObj() above, since UniValue::VNUM | // than use RPCTypeCheckObj() above, since UniValue::VNUM | ||||
// parser incorrectly parses numerics with quotes, eg | // parser incorrectly parses numerics with quotes, eg | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < mtx.vin.size(); i++) { | ||||
ProduceSignature(*keystore, | ProduceSignature(*keystore, | ||||
MutableTransactionSignatureCreator(&mtx, i, amount, | MutableTransactionSignatureCreator(&mtx, i, amount, | ||||
sigHashType), | sigHashType), | ||||
prevPubKey, sigdata); | prevPubKey, sigdata); | ||||
} | } | ||||
UpdateInput(txin, sigdata); | UpdateInput(txin, sigdata); | ||||
// amount must be specified for valid signature | |||||
if (amount == MAX_MONEY) { | |||||
throw JSONRPCError(RPC_TYPE_ERROR, | |||||
strprintf("Missing amount for %s", | |||||
coin->second.GetTxOut().ToString())); | |||||
} | |||||
ScriptError serror = ScriptError::OK; | ScriptError serror = ScriptError::OK; | ||||
if (!VerifyScript( | if (!VerifyScript( | ||||
txin.scriptSig, prevPubKey, STANDARD_SCRIPT_VERIFY_FLAGS, | txin.scriptSig, prevPubKey, STANDARD_SCRIPT_VERIFY_FLAGS, | ||||
TransactionSignatureChecker(&txConst, i, amount), &serror)) { | TransactionSignatureChecker(&txConst, i, amount), &serror)) { | ||||
if (serror == ScriptError::INVALID_STACK_OPERATION) { | if (serror == ScriptError::INVALID_STACK_OPERATION) { | ||||
// Unable to sign input and verification failed (possible | // Unable to sign input and verification failed (possible | ||||
// attempt to partially sign). | // attempt to partially sign). | ||||
TxInErrorToJSON(txin, vErrors, | TxInErrorToJSON(txin, vErrors, | ||||
Show All 19 Lines |