Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 387 Lines • ▼ Show 20 Lines | static UniValue verifytxoutproof(const Config &config, | ||||
CDataStream ssMB(ParseHexV(request.params[0], "proof"), SER_NETWORK, | CDataStream ssMB(ParseHexV(request.params[0], "proof"), SER_NETWORK, | ||||
PROTOCOL_VERSION); | PROTOCOL_VERSION); | ||||
CMerkleBlock merkleBlock; | CMerkleBlock merkleBlock; | ||||
ssMB >> merkleBlock; | ssMB >> merkleBlock; | ||||
UniValue res(UniValue::VARR); | UniValue res(UniValue::VARR); | ||||
std::vector<uint256> vMatch; | std::vector<TxId> vMatch; | ||||
std::vector<unsigned int> vIndex; | std::vector<unsigned int> vIndex; | ||||
if (merkleBlock.txn.ExtractMatches(vMatch, vIndex) != | if (merkleBlock.txn.ExtractMatches(vMatch, vIndex) != | ||||
merkleBlock.header.hashMerkleRoot) { | merkleBlock.header.hashMerkleRoot) { | ||||
return res; | return res; | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
if (!mapBlockIndex.count(merkleBlock.header.GetHash()) || | if (!mapBlockIndex.count(merkleBlock.header.GetHash()) || | ||||
!chainActive.Contains(mapBlockIndex[merkleBlock.header.GetHash()])) { | !chainActive.Contains(mapBlockIndex[merkleBlock.header.GetHash()])) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
"Block not found in chain"); | "Block not found in chain"); | ||||
} | } | ||||
for (const uint256 &hash : vMatch) { | for (const TxId &txid : vMatch) { | ||||
res.push_back(hash.GetHex()); | res.push_back(txid.GetHex()); | ||||
} | } | ||||
return res; | return res; | ||||
} | } | ||||
static UniValue createrawtransaction(const Config &config, | static UniValue createrawtransaction(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() < 2 || | if (request.fHelp || request.params.size() < 2 || | ||||
▲ Show 20 Lines • Show All 776 Lines • Show Last 20 Lines |