mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 23:29:12 +01:00
refactor: Use Txid in CMerkleBlock
This commit is contained in:
@@ -41,13 +41,13 @@ static RPCHelpMan gettxoutproof()
|
||||
RPCExamples{""},
|
||||
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||
{
|
||||
std::set<uint256> setTxids;
|
||||
std::set<Txid> setTxids;
|
||||
UniValue txids = request.params[0].get_array();
|
||||
if (txids.empty()) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Parameter 'txids' cannot be empty");
|
||||
}
|
||||
for (unsigned int idx = 0; idx < txids.size(); idx++) {
|
||||
auto ret = setTxids.insert(ParseHashV(txids[idx], "txid"));
|
||||
auto ret{setTxids.insert(Txid::FromUint256(ParseHashV(txids[idx], "txid")))};
|
||||
if (!ret.second) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, std::string("Invalid parameter, duplicated txid: ") + txids[idx].get_str());
|
||||
}
|
||||
@@ -69,7 +69,7 @@ static RPCHelpMan gettxoutproof()
|
||||
|
||||
// Loop through txids and try to find which block they're in. Exit loop once a block is found.
|
||||
for (const auto& tx : setTxids) {
|
||||
const Coin& coin = AccessByTxid(active_chainstate.CoinsTip(), Txid::FromUint256(tx));
|
||||
const Coin& coin{AccessByTxid(active_chainstate.CoinsTip(), tx)};
|
||||
if (!coin.IsSpent()) {
|
||||
pblockindex = active_chainstate.m_chain[coin.nHeight];
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user