From 7daffd50d82069b3b3c92766fe87aa1c6dfa5a84 Mon Sep 17 00:00:00 2001 From: Sunny King Date: Thu, 10 Nov 2011 16:44:59 +0000 Subject: [PATCH] PPCoin: Rescale coin definition to use 4 fractional digits --- src/main.cpp | 8 ++++---- src/main.h | 11 ++++++----- src/util.cpp | 3 ++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index d122852..4f1ee6d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,7 +31,7 @@ unsigned int nTransactionsUpdated = 0; map mapNextTx; map mapBlockIndex; -uint256 hashGenesisBlock("0x0000000088ddd1db81553a3908a2980587924d434938371aaa57d0e1e03e54dc"); +uint256 hashGenesisBlock("0x00000000e74ef41733382f8a94d41bf29f20c6c48a7ab489e1fab0ab719bf676"); CBigNum bnProofOfWorkLimit(~uint256(0) >> 32); const int nTotalBlocksEstimate = 134444; // Conservative estimate of total nr of blocks on main chain const int nInitialBlockThreshold = 120; // Regard blocks up until N-threshold as "initial download" @@ -1522,9 +1522,9 @@ bool LoadBlockIndex(bool fAllowNew) block.hashPrevBlock = 0; block.hashMerkleRoot = block.BuildMerkleTree(); block.nVersion = 1; - block.nTime = 1320807728; + block.nTime = 1320941849; block.nBits = 0x1d00ffff; - block.nNonce = 319190438; + block.nNonce = 725069208; if (fTestNet) { @@ -1537,7 +1537,7 @@ bool LoadBlockIndex(bool fAllowNew) printf("%s\n", block.GetHash().ToString().c_str()); printf("%s\n", hashGenesisBlock.ToString().c_str()); printf("%s\n", block.hashMerkleRoot.ToString().c_str()); - assert(block.hashMerkleRoot == uint256("0x4b9b3b5ebff8f552ba5c29e7eaa571ff16b63f50f6425865b280b3a7f670a2c4")); + assert(block.hashMerkleRoot == uint256("0x09cc647316c90e7e14f225113eec3539e80284695c91e7262a65c72c5d75a868")); block.print(); assert(block.GetHash() == hashGenesisBlock); diff --git a/src/main.h b/src/main.h index aa74ac5..77d9f36 100644 --- a/src/main.h +++ b/src/main.h @@ -1,4 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2011 The PPCoin developers // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_MAIN_H @@ -30,11 +31,11 @@ class CBlockIndex; 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 = 100000000; -static const int64 CENT = 1000000; -static const int64 MIN_TX_FEE = 50000; +static const int64 COIN = 10000; +static const int64 CENT = 100; +static const int64 MIN_TX_FEE = 10000; static const int64 MIN_RELAY_TX_FEE = 10000; -static const int64 MAX_MONEY = 21000000 * COIN; +static const int64 MAX_MONEY = 800000000000000 * COIN; inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); } static const int COINBASE_MATURITY = 100; #ifdef USE_UPNP @@ -375,7 +376,7 @@ public: { if (scriptPubKey.size() < 6) return "CTxOut(error)"; - return strprintf("CTxOut(nValue=%"PRI64d".%08"PRI64d", scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30).c_str()); + return strprintf("CTxOut(nValue=%s, scriptPubKey=%s)", FormatMoney(nValue).c_str(), scriptPubKey.ToString().substr(0,30).c_str()); } void print() const diff --git a/src/util.cpp b/src/util.cpp index 479c601..87453f2 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1,4 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2011 The PPCoin developers // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. #include "headers.h" @@ -337,7 +338,7 @@ string FormatMoney(int64 n, bool fPlus) int64 n_abs = (n > 0 ? n : -n); int64 quotient = n_abs/COIN; int64 remainder = n_abs%COIN; - string str = strprintf("%"PRI64d".%08"PRI64d, quotient, remainder); + string str = strprintf("%"PRI64d".%04"PRI64d, quotient, remainder); // Right-trim excess 0's before the decimal point: int nTrim = 0; -- 1.7.1