|
|
@ -244,16 +244,12 @@ static RPCHelpMan gettxoutproof()
|
|
|
|
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
|
|
|
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::set<uint256> setTxids;
|
|
|
|
std::set<uint256> setTxids;
|
|
|
|
uint256 oneTxid;
|
|
|
|
|
|
|
|
UniValue txids = request.params[0].get_array();
|
|
|
|
UniValue txids = request.params[0].get_array();
|
|
|
|
for (unsigned int idx = 0; idx < txids.size(); idx++) {
|
|
|
|
for (unsigned int idx = 0; idx < txids.size(); idx++) {
|
|
|
|
const UniValue& txid = txids[idx];
|
|
|
|
auto ret = setTxids.insert(ParseHashV(txids[idx], "txid"));
|
|
|
|
uint256 hash(ParseHashV(txid, "txid"));
|
|
|
|
if (!ret.second) {
|
|
|
|
if (setTxids.count(hash)) {
|
|
|
|
throw JSONRPCError(RPC_INVALID_PARAMETER, std::string("Invalid parameter, duplicated txid: ") + txids[idx].get_str());
|
|
|
|
throw JSONRPCError(RPC_INVALID_PARAMETER, std::string("Invalid parameter, duplicated txid: ") + txid.get_str());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setTxids.insert(hash);
|
|
|
|
|
|
|
|
oneTxid = hash;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CBlockIndex* pblockindex = nullptr;
|
|
|
|
CBlockIndex* pblockindex = nullptr;
|
|
|
@ -287,7 +283,7 @@ static RPCHelpMan gettxoutproof()
|
|
|
|
LOCK(cs_main);
|
|
|
|
LOCK(cs_main);
|
|
|
|
|
|
|
|
|
|
|
|
if (pblockindex == nullptr) {
|
|
|
|
if (pblockindex == nullptr) {
|
|
|
|
const CTransactionRef tx = GetTransaction(/* block_index */ nullptr, /* mempool */ nullptr, oneTxid, Params().GetConsensus(), hashBlock);
|
|
|
|
const CTransactionRef tx = GetTransaction(/* block_index */ nullptr, /* mempool */ nullptr, *setTxids.begin(), Params().GetConsensus(), hashBlock);
|
|
|
|
if (!tx || hashBlock.IsNull()) {
|
|
|
|
if (!tx || hashBlock.IsNull()) {
|
|
|
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not yet in block");
|
|
|
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not yet in block");
|
|
|
|
}
|
|
|
|
}
|
|
|
|