uint256 hash = tx.GetHash();
{
LOCK(cs_wallet);
- bool fExisted = mapWallet.count(hash);
+ bool fExisted = mapWallet.count(hash) != 0;
if (fExisted && !fUpdate) return false;
if (fExisted || IsMine(tx) || IsFromMe(tx))
{
{
// Do this infrequently and randomly to avoid giving away
// that these are our transactions.
- static int64_t nNextTime;
+ static int64_t nNextTime = GetRand(GetTime() + 30 * 60);
if (GetTime() < nNextTime)
return;
bool fFirst = (nNextTime == 0);
return;
// Only do it if there's been a new block since last time
- static int64_t nLastTime;
+ static int64_t nLastTime = 0;
if (nTimeBestReceived < nLastTime)
return;
nLastTime = GetTime();
nWeight = bnCoinDayWeight.getuint64();
}
-
-// NovaCoin: get current stake miner statistics
-void CWallet::GetStakeStats(float &nKernelsRate, float &nCoinDaysRate)
-{
- static uint64_t nLastKernels = 0, nLastCoinDays = 0;
- static float nLastKernelsRate = 0, nLastCoinDaysRate = 0;
- static int64_t nLastTime = GetTime();
-
- if (nKernelsTried < nLastKernels)
- {
- nLastKernels = 0;
- nLastCoinDays = 0;
-
- nLastTime = GetTime();
- }
-
- int64_t nInterval = GetTime() - nLastTime;
- //if (nKernelsTried > 1000 && nInterval > 5)
- if (nInterval > 10)
- {
- nKernelsRate = nLastKernelsRate = ( nKernelsTried - nLastKernels ) / (float) nInterval;
- nCoinDaysRate = nLastCoinDaysRate = ( nCoinDaysTried - nLastCoinDays ) / (float) nInterval;
-
- nLastKernels = nKernelsTried;
- nLastCoinDays = nCoinDaysTried;
- nLastTime = GetTime();
- }
- else
- {
- nKernelsRate = nLastKernelsRate;
- nCoinDaysRate = nLastCoinDaysRate;
- }
-}
-
bool CWallet::MergeCoins(const int64_t& nAmount, const int64_t& nMinValue, const int64_t& nOutputValue, list<uint256>& listMerged)
{
int64_t nBalance = GetBalance();
{
std::map<CTxDestination, std::string>::iterator mi = mapAddressBook.find(address);
mapAddressBook[address] = strName;
- NotifyAddressBookChanged(this, address, strName, ::IsMine(*this, address), (mi == mapAddressBook.end()) ? CT_NEW : CT_UPDATED);
+ NotifyAddressBookChanged(this, address, strName, ::IsMine(*this, address) != MINE_NO, (mi == mapAddressBook.end()) ? CT_NEW : CT_UPDATED);
if (!fFileBacked)
return false;
return CWalletDB(strWalletFile).WriteName(CBitcoinAddress(address).ToString(), strName);
bool CWallet::DelAddressBookName(const CTxDestination& address)
{
mapAddressBook.erase(address);
- NotifyAddressBookChanged(this, address, "", ::IsMine(*this, address), CT_DELETED);
+ NotifyAddressBookChanged(this, address, "", ::IsMine(*this, address) != MINE_NO, CT_DELETED);
if (!fFileBacked)
return false;
return CWalletDB(strWalletFile).EraseName(CBitcoinAddress(address).ToString());