Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | for (const CTxDestination &addr : addresses) { | ||||
a.push_back(EncodeDestination(addr)); | a.push_back(EncodeDestination(addr)); | ||||
} | } | ||||
out.push_back(Pair("addresses", a)); | out.push_back(Pair("addresses", a)); | ||||
} | } | ||||
void TxToJSON(const CTransaction &tx, const uint256 hashBlock, | void TxToJSON(const CTransaction &tx, const uint256 hashBlock, | ||||
UniValue &entry) { | UniValue &entry) { | ||||
entry.push_back(Pair("txid", tx.GetId().GetHex())); | entry.push_back(Pair("txid", tx.GetHash().GetHex())); | ||||
entry.push_back(Pair("hash", tx.GetHash().GetHex())); | entry.push_back(Pair("hash", tx.GetHash().GetHex())); | ||||
entry.push_back(Pair( | entry.push_back(Pair( | ||||
"size", (int)::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION))); | "size", (int)::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION))); | ||||
entry.push_back(Pair("version", tx.nVersion)); | entry.push_back(Pair("version", tx.nVersion)); | ||||
entry.push_back(Pair("locktime", (int64_t)tx.nLockTime)); | entry.push_back(Pair("locktime", (int64_t)tx.nLockTime)); | ||||
UniValue vin(UniValue::VARR); | UniValue vin(UniValue::VARR); | ||||
for (unsigned int i = 0; i < tx.vin.size(); i++) { | for (unsigned int i = 0; i < tx.vin.size(); i++) { | ||||
▲ Show 20 Lines • Show All 265 Lines • ▼ Show 20 Lines | static UniValue gettxoutproof(const Config &config, | ||||
CBlock block; | CBlock block; | ||||
if (!ReadBlockFromDisk(block, pblockindex, Params().GetConsensus())) { | if (!ReadBlockFromDisk(block, pblockindex, Params().GetConsensus())) { | ||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk"); | throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk"); | ||||
} | } | ||||
unsigned int ntxFound = 0; | unsigned int ntxFound = 0; | ||||
for (const auto &tx : block.vtx) { | for (const auto &tx : block.vtx) { | ||||
if (setTxids.count(tx->GetId())) { | if (setTxids.count(tx->GetHash())) { | ||||
ntxFound++; | ntxFound++; | ||||
} | } | ||||
} | } | ||||
if (ntxFound != setTxids.size()) { | if (ntxFound != setTxids.size()) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_INVALID_ADDRESS_OR_KEY, | RPC_INVALID_ADDRESS_OR_KEY, | ||||
"(Not all) transactions not found in specified block"); | "(Not all) transactions not found in specified block"); | ||||
▲ Show 20 Lines • Show All 748 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 uint256 &txid = tx->GetHash(); | ||||
bool fLimitFree = false; | bool fLimitFree = false; | ||||
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 = 0; | nMaxRawTxFee = 0; | ||||
} | } | ||||
CCoinsViewCache &view = *pcoinsTip; | CCoinsViewCache &view = *pcoinsTip; | ||||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |