Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction_util.cpp
Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | for (const std::string &name_ : outputs.getKeys()) { | ||||
if (!destinations.insert(destination).second) { | if (!destinations.insert(destination).second) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_INVALID_PARAMETER, | RPC_INVALID_PARAMETER, | ||||
std::string("Invalid parameter, duplicated address: ") + | std::string("Invalid parameter, duplicated address: ") + | ||||
name_); | name_); | ||||
} | } | ||||
CScript scriptPubKey = GetScriptForDestination(destination); | CScript scriptPubKey = GetScriptForDestination(destination); | ||||
Amount nAmount = AmountFromValue(outputs[name_]); | Amount nAmount = outputs[name_]; | ||||
CTxOut out(nAmount, scriptPubKey); | CTxOut out(nAmount, scriptPubKey); | ||||
rawTx.vout.push_back(out); | rawTx.vout.push_back(out); | ||||
} | } | ||||
} | } | ||||
return rawTx; | return rawTx; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | if (!prevTxsUnival.isNull()) { | ||||
"\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 = MAX_MONEY; | txout.nValue = MAX_MONEY; | ||||
if (prevOut.exists("amount")) { | if (prevOut.exists("amount")) { | ||||
txout.nValue = | txout.nValue = 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 | ||||
// "3.12" as a string when JSON allows it to also parse | // "3.12" as a string when JSON allows it to also parse | ||||
// as numeric. And we have to accept numerics with quotes | // as numeric. And we have to accept numerics with quotes | ||||
// because our own dogfood (our rpc results) always | // because our own dogfood (our rpc results) always | ||||
▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines |