From ca01452ddf42045cc9032cb1d4bafc245ad8500b Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 15 Jun 2013 20:39:34 +0400 Subject: [PATCH] Switch stakepower to available coin*age instead of spent coin*age --- src/wallet.cpp | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/wallet.cpp b/src/wallet.cpp index 613edc2..9cee9ef 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1376,11 +1376,16 @@ uint64 CWallet::GetStakeMintPower(const CKeyStore& keystore) if (pcoin.first->nTime + nStakeMaxAge > GetTime()) continue; - uint64 unCoinAge; - pcoin.first->GetCoinAge(txdb, unCoinAge); - nCoinAge += unCoinAge; + CBigNum bnCentSecond = CBigNum(pcoin.first->GetValueOut()) * (GetTime()-pcoin.first->nTime) / CENT; + CBigNum bnCoinDay = bnCentSecond * CENT / COIN / (24 * 60 * 60); + + + nCoinAge += bnCoinDay.getuint64(); } + if (fDebug && GetBoolArg("-printcoinage")) + printf("StakePower bnCoinDay=%"PRI64d"\n", nCoinAge); + return nCoinAge; } -- 1.7.1