Skip to content

Commit

Permalink
When rebuilding account view include mempool TX in coins view
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar committed Sep 13, 2023
1 parent 1dfeb92 commit b3fd350
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,14 @@ void CTxMemPool::removeForReorg(const CCoinsViewCache *pcoins, unsigned int nMem
if (pcustomcsview) {
accountsViewDirty |= forceRebuildForReorg;
CTransactionRef ptx{};
rebuildAccountsView(nMemPoolHeight, &::ChainstateActive().CoinsTip(), ptx);

CCoinsView dummy;
CCoinsViewCache view(&dummy);
CCoinsViewCache& coins_cache = ::ChainstateActive().CoinsTip();
CCoinsViewMemPool viewMemPool(&coins_cache, *this);
view.SetBackend(viewMemPool);

rebuildAccountsView(nMemPoolHeight, view, ptx);
}
}

Expand Down Expand Up @@ -619,7 +626,14 @@ void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigne
if (pcustomcsview) {
accountsViewDirty |= forceRebuildForReorg;
CTransactionRef ptx{};
rebuildAccountsView(nBlockHeight, &::ChainstateActive().CoinsTip(), ptx);

CCoinsView dummy;
CCoinsViewCache view(&dummy);
CCoinsViewCache& coins_cache = ::ChainstateActive().CoinsTip();
CCoinsViewMemPool viewMemPool(&coins_cache, *this);
view.SetBackend(viewMemPool);

rebuildAccountsView(nBlockHeight, view, ptx);
}

lastRollingFeeUpdate = GetTime();
Expand Down

0 comments on commit b3fd350

Please sign in to comment.