mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
Merge bitcoin/bitcoin#29260: refactor: remove CTxMemPool::queryHashes()
282b12ddb0
refactor: remove CTxMemPool::queryHashes() (stickies-v) Pull request description: `CTxMemPool::queryHashes()` is only used in `MempoolToJSON()`, where it can just as easily be replaced with the more general `CTxMemPool::entryAll()`. No behaviour change, just cleans up the code. ACKs for top commit: dergoegge: Code review ACK282b12ddb0
TheCharlatan: ACK282b12ddb0
glozow: ACK282b12ddb0
. Looks like there's no conflicts. Tree-SHA512: 16160dec8e1f2457fa0f62dc96d2d2efd92c4bab810ecdb0e08918b8e85a667702c8e41421eeb4ea6abe92a5956a2a39a7a6368514973b78be0d22de2ad299b2
This commit is contained in:
commit
651fb034d8
4 changed files with 5 additions and 23 deletions
|
@ -353,17 +353,15 @@ UniValue MempoolToJSON(const CTxMemPool& pool, bool verbose, bool include_mempoo
|
|||
}
|
||||
return o;
|
||||
} else {
|
||||
UniValue a(UniValue::VARR);
|
||||
uint64_t mempool_sequence;
|
||||
std::vector<uint256> vtxid;
|
||||
{
|
||||
LOCK(pool.cs);
|
||||
pool.queryHashes(vtxid);
|
||||
for (const CTxMemPoolEntry& e : pool.entryAll()) {
|
||||
a.push_back(e.GetTx().GetHash().ToString());
|
||||
}
|
||||
mempool_sequence = pool.GetSequence();
|
||||
}
|
||||
UniValue a(UniValue::VARR);
|
||||
for (const uint256& hash : vtxid)
|
||||
a.push_back(hash.ToString());
|
||||
|
||||
if (!include_mempool_sequence) {
|
||||
return a;
|
||||
} else {
|
||||
|
|
|
@ -101,9 +101,7 @@ void Finish(FuzzedDataProvider& fuzzed_data_provider, MockedTxPool& tx_pool, Cha
|
|||
if (!info_all.empty()) {
|
||||
const auto& tx_to_remove = *PickValue(fuzzed_data_provider, info_all).tx;
|
||||
WITH_LOCK(tx_pool.cs, tx_pool.removeRecursive(tx_to_remove, MemPoolRemovalReason::BLOCK /* dummy */));
|
||||
std::vector<uint256> all_txids;
|
||||
tx_pool.queryHashes(all_txids);
|
||||
assert(all_txids.size() < info_all.size());
|
||||
assert(tx_pool.size() < info_all.size());
|
||||
WITH_LOCK(::cs_main, tx_pool.check(chainstate.CoinsTip(), chainstate.m_chain.Height() + 1));
|
||||
}
|
||||
SyncWithValidationInterfaceQueue();
|
||||
|
|
|
@ -803,19 +803,6 @@ std::vector<CTxMemPool::indexed_transaction_set::const_iterator> CTxMemPool::Get
|
|||
return iters;
|
||||
}
|
||||
|
||||
void CTxMemPool::queryHashes(std::vector<uint256>& vtxid) const
|
||||
{
|
||||
LOCK(cs);
|
||||
auto iters = GetSortedDepthAndScore();
|
||||
|
||||
vtxid.clear();
|
||||
vtxid.reserve(mapTx.size());
|
||||
|
||||
for (auto it : iters) {
|
||||
vtxid.push_back(it->GetTx().GetHash());
|
||||
}
|
||||
}
|
||||
|
||||
static TxMempoolInfo GetInfo(CTxMemPool::indexed_transaction_set::const_iterator it) {
|
||||
return TxMempoolInfo{it->GetSharedTx(), it->GetTime(), it->GetFee(), it->GetTxSize(), it->GetModifiedFee() - it->GetFee()};
|
||||
}
|
||||
|
|
|
@ -485,7 +485,6 @@ public:
|
|||
void removeForBlock(const std::vector<CTransactionRef>& vtx, unsigned int nBlockHeight) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
|
||||
bool CompareDepthAndScore(const uint256& hasha, const uint256& hashb, bool wtxid=false);
|
||||
void queryHashes(std::vector<uint256>& vtxid) const;
|
||||
bool isSpent(const COutPoint& outpoint) const;
|
||||
unsigned int GetTransactionsUpdated() const;
|
||||
void AddTransactionsUpdated(unsigned int n);
|
||||
|
|
Loading…
Add table
Reference in a new issue