Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ismaelsadeeq committed Aug 26, 2023
1 parent a6000ad commit 6695456
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,10 @@ void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAnces
nTransactionsUpdated++;
totalTxSize += entry.GetTxSize();
m_total_fee += entry.GetFee();
NewMempoolTransactionInfo tx_info = { entry.GetSharedTx(), entry.GetFee(), entry.GetTxSize(), validFeeEstimate };
if (minerPolicyEstimator) {
minerPolicyEstimator->processTransaction(entry, validFeeEstimate);
minerPolicyEstimator->processTransaction(tx_info);
}
GetMainSignals().MempoolAcceptNewTransaction(entry, validFeeEstimate);
vTxHashes.emplace_back(tx.GetWitnessHash(), newit);
newit->vTxHashesIdx = vTxHashes.size() - 1;

Expand Down Expand Up @@ -623,17 +623,6 @@ void CTxMemPool::removeConflicts(const CTransaction &tx)
void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigned int nBlockHeight)
{
AssertLockHeld(cs);
std::vector<const CTxMemPoolEntry*> entries;
for (const auto& tx : vtx)
{
uint256 hash = tx->GetHash();

indexed_transaction_set::iterator i = mapTx.find(hash);
if (i != mapTx.end())
entries.push_back(&*i);
}
// Before the txs in the new block have been removed from the mempool, update policy estimates
if (minerPolicyEstimator) {minerPolicyEstimator->processBlock(nBlockHeight, entries);}
std::vector<CTransactionRef> txs_removed_for_block;
for (const auto& tx : vtx)
{
Expand All @@ -648,6 +637,12 @@ void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigne
ClearPrioritisation(tx->GetHash());
}
GetMainSignals().MempoolBlockConnect(txs_removed_for_block, nBlockHeight);
if (minerPolicyEstimator) {
int size = minerPolicyEstimator->GetMapSize();
LogPrintf("size before calling is %s \n", size);
}
// Before the txs in the new block have been removed from the mempool, update policy estimates
if (minerPolicyEstimator) {minerPolicyEstimator->processBlock(nBlockHeight, txs_removed_for_block);}
lastRollingFeeUpdate = GetTime();
blockSinceLastRollingFeeBump = true;
}
Expand Down

0 comments on commit 6695456

Please sign in to comment.