Skip to content

Commit

Permalink
Merge pull request CoinBlack#26 from BlackcoinDev/orphanedstakes
Browse files Browse the repository at this point in the history
staking: move `AbandonOrphanedCoinstakes` to BlockDisconnect
  • Loading branch information
lateminer authored Sep 30, 2024
2 parents a58ce9e + f0fea10 commit cb4e454
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 0 additions & 3 deletions src/node/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,6 @@ std::unique_ptr<CBlockTemplate> 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);
Expand Down
6 changes: 3 additions & 3 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1507,6 +1507,9 @@ void CWallet::blockDisconnected(const interfaces::BlockInfo& block)
}
}
}

// Blackcoin - Call to abandon orphaned coinstakes after handling disconnections
AbandonOrphanedCoinstakes();
}

void CWallet::updatedBlockTip()
Expand Down Expand Up @@ -3131,9 +3134,6 @@ std::shared_ptr<CWallet> 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;
}

Expand Down

0 comments on commit cb4e454

Please sign in to comment.