return CreateTransaction(vecSend, wtxNew, reservekey, nFeeRet);
}
+// NovaCoin: get current stake generation power
+uint64 CWallet::GetStakeMintPower(const CKeyStore& keystore)
+{
+ LOCK2(cs_main, cs_wallet);
+
+ // Choose coins to use
+ int64 nBalance = GetBalance();
+ int64 nReserveBalance = 0;
+ uint64 nCoinAge = 0;
+
+ if (mapArgs.count("-reservebalance") && !ParseMoney(mapArgs["-reservebalance"], nReserveBalance))
+ {
+ error("CreateCoinStake : invalid reserve balance amount");
+ return 0;
+ }
+
+ if (nBalance <= nReserveBalance)
+ return 0;
+
+ set<pair<const CWalletTx*,unsigned int> > setCoins;
+ vector<const CWalletTx*> vwtxPrev;
+ int64 nValueIn = 0;
+ if (!SelectCoins(nBalance - nReserveBalance, GetTime(), setCoins, nValueIn))
+ return 0;
+ if (setCoins.empty())
+ return 0;
+
+ BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins)
+ {
+ CTxDB txdb("r");
+ CTxIndex txindex;
+ if (!txdb.ReadTxIndex(pcoin.first->GetHash(), txindex))
+ continue;
+
+ // Do not count input that is still too young
+ if (pcoin.first->nTime + nStakeMaxAge > GetTime())
+ continue;
+
+ uint64 unCoinAge;
+ pcoin.first->GetCoinAge(txdb, unCoinAge);
+ nCoinAge += unCoinAge;
+ }
+
+ return nCoinAge;
+}
+
// ppcoin: create coin stake transaction
bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int64 nSearchInterval, CTransaction& txNew)
{