static const unsigned int MAX_BLOCK_SIZE = 1000000;
static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2;
static const int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50;
-static const int64 COIN = 10000;
-static const int64 CENT = 100;
+static const int64 COIN = 1000000;
+static const int64 CENT = 10000;
static const int64 MIN_TX_FEE = 10000;
static const int64 MIN_RELAY_TX_FEE = 10000;
-static const int64 MAX_MONEY = 800000000000000 * COIN;
+static const int64 MAX_MONEY = 2000000000 * COIN;
inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
static const int COINBASE_MATURITY = 100;
// Threshold for nLockTime: below this value it is interpreted as block number, otherwise as UNIX timestamp.
return dPriority > COIN * 144 / 250;
}
- int64 GetMinFee(unsigned int nBlockSize=1, bool fAllowFree=true, bool fForRelay=false) const
+ int64 GetMinFee(unsigned int nBlockSize=1, bool fAllowFree=false, bool fForRelay=false) const
{
// Base fee is either MIN_TX_FEE or MIN_RELAY_TX_FEE
int64 nBaseFee = fForRelay ? MIN_RELAY_TX_FEE : MIN_TX_FEE;
unsigned int nBytes = ::GetSerializeSize(*this, SER_NETWORK);
unsigned int nNewBlockSize = nBlockSize + nBytes;
- int64 nMinFee = nBaseFee; // ppcoin: simplify transaction fee
+ int64 nMinFee = (1 + (int64)nBytes / 1000) * nBaseFee;
if (fAllowFree)
{
unsigned int nBlockPos;
uint64 nChainTrust;// ppcoin: trust score of chain, in the unit of coin-days
int nHeight;
+ int nCheckpoint; // ppcoin: chain auto checkpoint height
// block header
int nVersion;
nBlockPos = 0;
nHeight = 0;
nChainTrust = 0;
+ nCheckpoint = 0;
nVersion = 0;
hashMerkleRoot = 0;
nBlockPos = nBlockPosIn;
nHeight = 0;
nChainTrust = 0;
+ nCheckpoint = 0;
nVersion = block.nVersion;
hashMerkleRoot = block.hashMerkleRoot;
int64 GetBlockTrust() const
{
- return (nChainTrust - pprev->nChainTrust);
+ return (nChainTrust - (pprev? pprev->nChainTrust : 0));
}
bool IsInMainChain() const
std::string ToString() const
{
- return strprintf("CBlockIndex(nprev=%08x, pnext=%08x, nFile=%d, nBlockPos=%-6d nChainTrust=%"PRI64d" nHeight=%d, merkle=%s, hashBlock=%s)",
- pprev, pnext, nFile, nBlockPos, nChainTrust, nHeight,
+ return strprintf("CBlockIndex(nprev=%08x, pnext=%08x, nFile=%d, nBlockPos=%-6d nChainTrust=%"PRI64d" nHeight=%d, nCheckpoint=%d, merkle=%s, hashBlock=%s)",
+ pprev, pnext, nFile, nBlockPos, nChainTrust, nHeight, nCheckpoint,
hashMerkleRoot.ToString().substr(0,10).c_str(),
GetBlockHash().ToString().substr(0,20).c_str());
}
READWRITE(nBlockPos);
READWRITE(nChainTrust);
READWRITE(nHeight);
+ READWRITE(nCheckpoint);
// block header
READWRITE(this->nVersion);