From 79b388a36e87ec49aef8be503a94deedd359539d Mon Sep 17 00:00:00 2001 From: BlackcoinDev Date: Sun, 22 Sep 2024 21:41:04 +0200 Subject: [PATCH 1/2] staking: remove `AbandonOrphanedCoinstakes` from staking process might impact staking performance --- src/node/miner.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/node/miner.cpp b/src/node/miner.cpp index b1acd06fec..b43f52e697 100644 --- a/src/node/miner.cpp +++ b/src/node/miner.cpp @@ -213,9 +213,6 @@ std::unique_ptr BlockAssembler::CreateNewBlock(const CScript& sc static int64_t nLastCoinStakeSearchTime = GetAdjustedTimeSeconds(); // only initialized at startup if (pwallet) { - // flush orphaned coinstakes - pwallet->AbandonOrphanedCoinstakes(); - // attempt to find a coinstake *pfPoSCancel = true; pblock->nBits = GetNextTargetRequired(pindexPrev, chainparams.GetConsensus(), true); From f0fea101ffab3446d57f817db00e14376bd27f50 Mon Sep 17 00:00:00 2001 From: BlackcoinDev Date: Sun, 22 Sep 2024 21:42:35 +0200 Subject: [PATCH 2/2] wallet: move `AbandonOrphanedCoinstakes` to `DisconnectBlock` it impacts loading wallets --- src/wallet/wallet.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 1de80460d1..77de445c39 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1507,6 +1507,9 @@ void CWallet::blockDisconnected(const interfaces::BlockInfo& block) } } } + + // Blackcoin - Call to abandon orphaned coinstakes after handling disconnections + AbandonOrphanedCoinstakes(); } void CWallet::updatedBlockTip() @@ -3131,9 +3134,6 @@ std::shared_ptr CWallet::Create(WalletContext& context, const std::stri walletInstance->WalletLogPrintf("m_address_book.size() = %u\n", walletInstance->m_address_book.size()); } - // Flush orphaned coinstakes - walletInstance->AbandonOrphanedCoinstakes(); - return walletInstance; }