Proof-of-stake related code refactoring and cleanup
This commit is contained in:
@@ -607,8 +607,8 @@ void CWallet::AvailableCoinsForStaking(std::vector<COutput>& vCoins) const
|
||||
if (nDepth < 1)
|
||||
continue;
|
||||
|
||||
if (nDepth < Params().GetConsensus().nStakeMinConfirmations)
|
||||
continue;
|
||||
if (nDepth < Params().GetConsensus().nStakeMinConfirmations)
|
||||
continue;
|
||||
|
||||
if (pcoin->GetBlocksToMaturity() > 0)
|
||||
continue;
|
||||
@@ -626,6 +626,13 @@ void CWallet::AvailableCoinsForStaking(std::vector<COutput>& vCoins) const
|
||||
}
|
||||
}
|
||||
|
||||
bool CWallet::HaveAvailableCoinsForStaking() const
|
||||
{
|
||||
vector<COutput> vCoins;
|
||||
AvailableCoinsForStaking(vCoins);
|
||||
return vCoins.size() > 0;
|
||||
}
|
||||
|
||||
// Select some coins without random shuffle or best subset approximation
|
||||
bool CWallet::SelectCoinsForStaking(CAmount& nTargetValue, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet) const
|
||||
{
|
||||
|
||||
@@ -904,9 +904,12 @@ public:
|
||||
|
||||
/* Mark a transaction (and it in-wallet descendants) as abandoned so its inputs may be respent. */
|
||||
bool AbandonTransaction(const uint256& hashTx);
|
||||
|
||||
/* Staking */
|
||||
bool CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int64_t nSearchInterval, CAmount& nFees, CMutableTransaction& tx, CKey& key);
|
||||
bool SelectCoinsForStaking(CAmount& nTargetValue, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet) const;
|
||||
void AvailableCoinsForStaking(std::vector<COutput>& vCoins) const;
|
||||
bool HaveAvailableCoinsForStaking() const;
|
||||
uint64_t GetStakeWeight() const;
|
||||
|
||||
/* Returns the wallets help message */
|
||||
|
||||
Reference in New Issue
Block a user