Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 479 Lines • ▼ Show 20 Lines | if (request.params.size() > 2 && !request.params[2].isNull()) { | ||||
rawTx.nLockTime = nLockTime; | rawTx.nLockTime = nLockTime; | ||||
} | } | ||||
for (size_t idx = 0; idx < inputs.size(); idx++) { | for (size_t idx = 0; idx < inputs.size(); idx++) { | ||||
const UniValue &input = inputs[idx]; | const UniValue &input = inputs[idx]; | ||||
const UniValue &o = input.get_obj(); | const UniValue &o = input.get_obj(); | ||||
uint256 txid = ParseHashO(o, "txid"); | TxId txid(ParseHashO(o, "txid")); | ||||
jasonbcox: nit: const | |||||
const UniValue &vout_v = find_value(o, "vout"); | const UniValue &vout_v = find_value(o, "vout"); | ||||
if (vout_v.isNull()) { | if (vout_v.isNull()) { | ||||
throw JSONRPCError(RPC_INVALID_PARAMETER, | throw JSONRPCError(RPC_INVALID_PARAMETER, | ||||
"Invalid parameter, missing vout key"); | "Invalid parameter, missing vout key"); | ||||
} | } | ||||
if (!vout_v.isNum()) { | if (!vout_v.isNum()) { | ||||
▲ Show 20 Lines • Show All 366 Lines • ▼ Show 20 Lines | if (!prevTxsUnival.isNull()) { | ||||
{"vout", UniValueType(UniValue::VNUM)}, | {"vout", UniValueType(UniValue::VNUM)}, | ||||
{"scriptPubKey", UniValueType(UniValue::VSTR)}, | {"scriptPubKey", UniValueType(UniValue::VSTR)}, | ||||
// "amount" is also required but check is done | // "amount" is also required but check is done | ||||
// below due to UniValue::VNUM erroneously | // below due to UniValue::VNUM erroneously | ||||
// not accepting quoted numerics | // not accepting quoted numerics | ||||
// (which are valid JSON) | // (which are valid JSON) | ||||
}); | }); | ||||
uint256 txid = ParseHashO(prevOut, "txid"); | TxId txid(ParseHashO(prevOut, "txid")); | ||||
jasonbcoxUnsubmitted Not Done Inline Actionsnit: const jasonbcox: nit: const | |||||
int nOut = find_value(prevOut, "vout").get_int(); | int nOut = find_value(prevOut, "vout").get_int(); | ||||
if (nOut < 0) { | if (nOut < 0) { | ||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, | throw JSONRPCError(RPC_DESERIALIZATION_ERROR, | ||||
"vout must be positive"); | "vout must be positive"); | ||||
} | } | ||||
COutPoint out(txid, nOut); | COutPoint out(txid, nOut); | ||||
▲ Show 20 Lines • Show All 426 Lines • ▼ Show 20 Lines | static UniValue sendrawtransaction(const Config &config, | ||||
// parse hex string from parameter | // parse hex string from parameter | ||||
CMutableTransaction mtx; | CMutableTransaction mtx; | ||||
if (!DecodeHexTx(mtx, request.params[0].get_str())) { | if (!DecodeHexTx(mtx, request.params[0].get_str())) { | ||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); | throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); | ||||
} | } | ||||
CTransactionRef tx(MakeTransactionRef(std::move(mtx))); | CTransactionRef tx(MakeTransactionRef(std::move(mtx))); | ||||
const uint256 &txid = tx->GetId(); | const TxId &txid = tx->GetId(); | ||||
Amount nMaxRawTxFee = maxTxFee; | Amount nMaxRawTxFee = maxTxFee; | ||||
if (request.params.size() > 1 && request.params[1].get_bool()) { | if (request.params.size() > 1 && request.params[1].get_bool()) { | ||||
nMaxRawTxFee = Amount::zero(); | nMaxRawTxFee = Amount::zero(); | ||||
} | } | ||||
{ // cs_main scope | { // cs_main scope | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
▲ Show 20 Lines • Show All 172 Lines • Show Last 20 Lines |
nit: const