Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 309 Lines • ▼ Show 20 Lines | static UniValue gettxoutproof(const Config &config, | ||||
uint256 hashBlock; | uint256 hashBlock; | ||||
if (request.params.size() > 1) { | if (request.params.size() > 1) { | ||||
hashBlock = uint256S(request.params[1].get_str()); | hashBlock = uint256S(request.params[1].get_str()); | ||||
if (!mapBlockIndex.count(hashBlock)) | if (!mapBlockIndex.count(hashBlock)) | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); | ||||
pblockindex = mapBlockIndex[hashBlock]; | pblockindex = mapBlockIndex[hashBlock]; | ||||
} else { | } else { | ||||
CCoins coins; | const Coin &coin = AccessByTxid(*pcoinsTip, oneTxid); | ||||
if (pcoinsTip->GetCoins_DONOTUSE(oneTxid, coins) && coins.nHeight > 0 && | if (!coin.IsSpent() && coin.GetHeight() > 0 && | ||||
coins.nHeight <= chainActive.Height()) | int64_t(coin.GetHeight()) <= chainActive.Height()) { | ||||
pblockindex = chainActive[coins.nHeight]; | pblockindex = chainActive[coin.GetHeight()]; | ||||
} | |||||
} | } | ||||
if (pblockindex == nullptr) { | if (pblockindex == nullptr) { | ||||
CTransactionRef tx; | CTransactionRef tx; | ||||
if (!GetTransaction(config, oneTxid, tx, hashBlock, false) || | if (!GetTransaction(config, oneTxid, tx, hashBlock, false) || | ||||
hashBlock.IsNull()) { | hashBlock.IsNull()) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
"Transaction not yet in block"); | "Transaction not yet in block"); | ||||
▲ Show 20 Lines • Show All 858 Lines • Show Last 20 Lines |