Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 469 Lines • ▼ Show 20 Lines | static UniValue createrawtransaction(const Config &config, | ||||
UniValue inputs = request.params[0].get_array(); | UniValue inputs = request.params[0].get_array(); | ||||
const bool outputs_is_obj = request.params[1].isObject(); | const bool outputs_is_obj = request.params[1].isObject(); | ||||
UniValue outputs = outputs_is_obj ? request.params[1].get_obj() | UniValue outputs = outputs_is_obj ? request.params[1].get_obj() | ||||
: request.params[1].get_array(); | : request.params[1].get_array(); | ||||
CMutableTransaction rawTx; | CMutableTransaction rawTx; | ||||
if (request.params.size() > 2 && !request.params[2].isNull()) { | if (!request.params[2].isNull()) { | ||||
int64_t nLockTime = request.params[2].get_int64(); | int64_t nLockTime = request.params[2].get_int64(); | ||||
if (nLockTime < 0 || nLockTime > std::numeric_limits<uint32_t>::max()) { | if (nLockTime < 0 || nLockTime > std::numeric_limits<uint32_t>::max()) { | ||||
throw JSONRPCError(RPC_INVALID_PARAMETER, | throw JSONRPCError(RPC_INVALID_PARAMETER, | ||||
"Invalid parameter, locktime out of range"); | "Invalid parameter, locktime out of range"); | ||||
} | } | ||||
rawTx.nLockTime = nLockTime; | rawTx.nLockTime = nLockTime; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 684 Lines • ▼ Show 20 Lines | static UniValue sendrawtransaction(const Config &config, | ||||
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 TxId &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[1].isNull() && request.params[1].get_bool()) { | ||||
nMaxRawTxFee = Amount::zero(); | nMaxRawTxFee = Amount::zero(); | ||||
} | } | ||||
{ // cs_main scope | { // cs_main scope | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
CCoinsViewCache &view = *pcoinsTip; | CCoinsViewCache &view = *pcoinsTip; | ||||
bool fHaveChain = false; | bool fHaveChain = false; | ||||
for (size_t o = 0; !fHaveChain && o < tx->vout.size(); o++) { | for (size_t o = 0; !fHaveChain && o < tx->vout.size(); o++) { | ||||
▲ Show 20 Lines • Show All 168 Lines • Show Last 20 Lines |