Replace GenTxid with Txid/Wtxid overloads in txmempool

Co-authored-by: stickies-v <stickies-v@protonmail.com>
This commit is contained in:
marcofleon
2025-03-31 16:28:50 +01:00
parent de858ce2be
commit c876a892ec
20 changed files with 95 additions and 91 deletions

View File

@@ -886,24 +886,6 @@ CTransactionRef CTxMemPool::get(const uint256& hash) const
return i->GetSharedTx();
}
TxMempoolInfo CTxMemPool::info(const GenTxid& gtxid) const
{
LOCK(cs);
auto i = (gtxid.IsWtxid() ? GetIter(Wtxid::FromUint256(gtxid.GetHash())) : GetIter(Txid::FromUint256(gtxid.GetHash())));
return i.has_value() ? GetInfo(*i) : TxMempoolInfo{};
}
TxMempoolInfo CTxMemPool::info_for_relay(const GenTxid& gtxid, uint64_t last_sequence) const
{
LOCK(cs);
auto i = (gtxid.IsWtxid() ? GetIter(Wtxid::FromUint256(gtxid.GetHash())) : GetIter(Txid::FromUint256(gtxid.GetHash())));
if (i.has_value() && (*i)->GetSequence() < last_sequence) {
return GetInfo(*i);
} else {
return TxMempoolInfo();
}
}
void CTxMemPool::PrioritiseTransaction(const uint256& hash, const CAmount& nFeeDelta)
{
{
@@ -1018,7 +1000,7 @@ std::vector<CTxMemPool::txiter> CTxMemPool::GetIterVec(const std::vector<uint256
bool CTxMemPool::HasNoInputsOf(const CTransaction &tx) const
{
for (unsigned int i = 0; i < tx.vin.size(); i++)
if (exists(GenTxid::Txid(tx.vin[i].prevout.hash)))
if (exists(tx.vin[i].prevout.hash))
return false;
return true;
}
@@ -1188,7 +1170,7 @@ void CTxMemPool::TrimToSize(size_t sizelimit, std::vector<COutPoint>* pvNoSpends
if (pvNoSpendsRemaining) {
for (const CTransaction& tx : txn) {
for (const CTxIn& txin : tx.vin) {
if (exists(GenTxid::Txid(txin.prevout.hash))) continue;
if (exists(txin.prevout.hash)) continue;
pvNoSpendsRemaining->push_back(txin.prevout);
}
}