"Returns an object containing various state info.");
Object obj;
- obj.push_back(Pair("version", (int)VERSION));
+ obj.push_back(Pair("version", FormatFullVersion()));
obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance())));
obj.push_back(Pair("newmint", ValueFromAmount(pwalletMain->GetNewMint())));
obj.push_back(Pair("stake", ValueFromAmount(pwalletMain->GetStake())));
uint256 AutoSelectSyncCheckpoint()
{
- // select block roughly 8 hours ago
+ // select a block some time ago
CBlockIndex *pindex = mapBlockIndex[hashSyncCheckpoint];
- while (pindex->pnext && pindex->pnext->GetBlockTime() + AUTO_CHECKPOINT_MIN_SPAN <= GetAdjustedTime())
+ while (pindex->pnext && pindex->pnext->GetBlockTime() + CHECKPOINT_MIN_SPAN <= GetAdjustedTime())
pindex = pindex->pnext;
return pindex->GetBlockHash();
}
hashPendingCheckpoint = hash;
checkpointMessagePending.SetNull();
printf("ResetSyncCheckpoint: pending for sync-checkpoint %s\n", hashPendingCheckpoint.ToString().c_str());
- // TODO: when to ask for the checkpoint chain?
}
BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, mapCheckpoints)
#include <map>
#include "util.h"
-// ppcoin: auto checkpoint min at 8 hours; max at 16 hours
-#define AUTO_CHECKPOINT_MIN_SPAN (60 * 60 * 8)
-#define AUTO_CHECKPOINT_MAX_SPAN (60 * 60 * 16)
-#define AUTO_CHECKPOINT_TRUST_SPAN (60 * 60 * 24)
+#define STAKE_MIN_AGE (60 * 60 * 24) // minimum age for coin age
+#define CHECKPOINT_MIN_SPAN (60 * 60 * 4) // 4 hours checkpoint
class uint256;
class CBlockIndex;
CBlock block;
if (!block.ReadFromDisk(txindex.pos.nFile, txindex.pos.nBlockPos, false))
return false; // unable to read block of previous transaction
- if (block.GetBlockTime() + AUTO_CHECKPOINT_TRUST_SPAN > nTime)
- return false; // only count coins from at least one week ago
+ if (block.GetBlockTime() + STAKE_MIN_AGE > nTime)
+ return false; // only count coins meeting min age requirement
int64 nValueIn = txPrev.vout[txin.prevout.n].nValue;
CBigNum bnCoinDay = CBigNum(nValueIn) * (nTime-txPrev.nTime) / COIN / (24 * 60 * 60);
}
// ppcoin: total coin age spent in transaction, in the unit of coin-days.
-// Only those coins last spent at least a week ago count. As those
+// Only those coins meeting minimum age requirement counts. As those
// transactions not in main chain are not currently indexed so we
// might not find out about their coin age. Older transactions are
-// guaranteed to be in main chain by auto checkpoint. This rule is
+// guaranteed to be in main chain by sync-checkpoint. This rule is
// introduced to help nodes establish a consistent view of the coin
// age (trust score) of competing branches.
bool CTransaction::GetCoinAge(CTxDB& txdb, uint64& nCoinAge) const
CBlock block;
if (!block.ReadFromDisk(txindex.pos.nFile, txindex.pos.nBlockPos, false))
return false; // unable to read block of previous transaction
- if (block.GetBlockTime() + AUTO_CHECKPOINT_TRUST_SPAN > nTime)
- continue; // only count coins from at least one week ago
+ if (block.GetBlockTime() + STAKE_MIN_AGE > nTime)
+ continue; // only count coins meeting min age requirement
int64 nValueIn = txPrev.vout[txin.prevout.n].nValue;
bnCentSecond += CBigNum(nValueIn) * (nTime-txPrev.nTime) / CENT;
static const char* pszSubVer = "";
static const bool VERSION_IS_BETA = true;
+static const int PPCOIN_VERSION = 100;
+
// Used to bypass the rule against non-const reference to temporary
// where it makes sense with wrappers such as CFlatData or CTxDB
template<typename T>
string FormatFullVersion()
{
- string s = FormatVersion(VERSION) + pszSubVer;
+ string s = FormatVersion(PPCOIN_VERSION) + pszSubVer;
if (VERSION_IS_BETA) {
s += "-";
s += _("beta");
CBlock block;
if (!block.ReadFromDisk(txindex.pos.nFile, txindex.pos.nBlockPos, false))
continue;
- if (block.GetBlockTime() + AUTO_CHECKPOINT_TRUST_SPAN > txNew.nTime)
- continue; // only count coins from at least one week ago
+ if (block.GetBlockTime() + STAKE_MIN_AGE > txNew.nTime)
+ continue; // only count coins meeting min age requirement
int64 nValueIn = pcoin.first->vout[pcoin.second].nValue;
CBigNum bnCoinDay = CBigNum(nValueIn) * (txNew.nTime-pcoin.first->nTime) / COIN / (24 * 60 * 60);