Skip to content

Commit

Permalink
Improving the listtransactions performance
Browse files Browse the repository at this point in the history
  • Loading branch information
a-bezrukov committed Apr 19, 2021
1 parent d76b2c5 commit f651249
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/evo/deterministicmns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ bool CDeterministicMNManager::IsDIP3Enforced(int nHeight)

void CDeterministicMNManager::CleanupCache(int nHeight)
{
LOCK(cs);
AssertLockHeld(cs);

std::vector<uint256> toDelete;
for (const auto& p : mnListsCache) {
Expand Down
2 changes: 1 addition & 1 deletion src/evo/deterministicmns.h
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ class CDeterministicMNManager
void UpgradeDBIfNeeded();
static bool IsDIP3Active(int height);

public:
private:
void CleanupCache(int nHeight);
};

Expand Down
8 changes: 0 additions & 8 deletions src/masternode-payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,6 @@ bool CMasternodePayments::GetBlockTxOuts(int nBlockHeight, CAmount blockReward,
return true;
}

bool CMasternodePayments::GetBlockTxOutsWipeCache(int nBlockHeight, CAmount blockReward, std::vector<CTxOut>& voutMasternodePaymentsRet) const
{
bool result = GetBlockTxOuts(nBlockHeight, blockReward, voutMasternodePaymentsRet);
AssertLockHeld(cs_main);
deterministicMNManager->CleanupCache(chainActive.Height());
return result;
}

// Is this masternode scheduled to get paid soon?
// -- Only look ahead up to 8 blocks to allow for propagation of the latest 2 blocks of votes
bool CMasternodePayments::IsScheduled(const CDeterministicMNCPtr& dmnIn, int nNotBlockHeight) const
Expand Down
1 change: 0 additions & 1 deletion src/masternode-payments.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class CMasternodePayments
{
public:
bool GetBlockTxOuts(int nBlockHeight, CAmount blockReward, std::vector<CTxOut>& voutMasternodePaymentsRet) const;
bool GetBlockTxOutsWipeCache(int nBlockHeight, CAmount blockReward, std::vector<CTxOut>& voutMasternodePaymentsRet) const;
bool IsTransactionValid(const CTransaction& txNew, int nBlockHeight, CAmount blockReward) const;
bool IsScheduled(const CDeterministicMNCPtr& dmn, int nNotBlockHeight) const;

Expand Down
2 changes: 1 addition & 1 deletion src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,7 @@ void ListTransactions(CWallet * const pwallet, const CWalletTx& wtx, const strin
bool its_znode_payment = false;
if (!fSkipMnpayoutCheck) {
std::vector<CTxOut> voutMasternodePaymentsRet;
mnpayments.GetBlockTxOutsWipeCache(txHeight, CAmount(), voutMasternodePaymentsRet);
mnpayments.GetBlockTxOuts(txHeight, CAmount(), voutMasternodePaymentsRet);
//compare address of payee to addr.
for(CTxOut const & out : voutMasternodePaymentsRet) {
CTxDestination payeeDest;
Expand Down

0 comments on commit f651249

Please sign in to comment.