Skip to content

Commit

Permalink
POS fixes, new seednodes, new checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
liteuser committed Dec 3, 2014
1 parent 16066de commit 9dd5c4c
Show file tree
Hide file tree
Showing 76 changed files with 31 additions and 925 deletions.
3 changes: 2 additions & 1 deletion src/checkpoints.cpp
Expand Up @@ -26,6 +26,7 @@ namespace Checkpoints
boost::assign::map_list_of
( 0, hashGenesisBlock )
( 1, uint256("0x000009ffd286eac9aa4c0bfad28be83e3e5c65365484c7fb7425d5df60f4060a"))
(13999, uint256("0x00000000135c5aa0fe51af8775073b8921ca31696393175af9903a8db08669e6"))
;

// TestNet has no checkpoints
Expand Down Expand Up @@ -348,7 +349,7 @@ namespace Checkpoints
}

// ppcoin: sync-checkpoint master key
const std::string CSyncCheckpoint::strMasterPubKey = "03a2e19f412c1474b128cf8a107a26d17f9466e43eaeca46f2320248de295ef8f5";
const std::string CSyncCheckpoint::strMasterPubKey = "0478eb43c1fde16a539ff8a48648705b981ba119e1bf1868ee1143e5ab9487fb8ef0c58f213b6841ff7adb61b18cba757a0f1e1249a8fd69a29353df4ed491547d";

std::string CSyncCheckpoint::strMasterPrivKey = "";

Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Expand Up @@ -7,7 +7,7 @@

// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 1
#define CLIENT_VERSION_MINOR 1
#define CLIENT_VERSION_MINOR 2
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 0

Expand Down
2 changes: 1 addition & 1 deletion src/init.cpp
Expand Up @@ -589,7 +589,7 @@ bool AppInit2()
}
}
#if defined(USE_IPV6)
#if ! USE_IPV6
#if !USE_IPV6
else
SetLimited(NET_IPV6);
#endif
Expand Down
1 change: 0 additions & 1 deletion src/kernel.cpp
Expand Up @@ -389,7 +389,6 @@ unsigned int GetStakeModifierChecksum(const CBlockIndex* pindex)
// Check stake modifier hard checkpoints
bool CheckStakeModifierCheckpoints(int nHeight, unsigned int nStakeModifierChecksum)
{
printf("nStakeModifierChecksum x = %x \n", nStakeModifierChecksum);
MapModifierCheckpoints& checkpoints = (fTestNet ? mapStakeModifierCheckpointsTestNet : mapStakeModifierCheckpoints);
if (checkpoints.count(nHeight))
return nStakeModifierChecksum == checkpoints[nHeight];
Expand Down
25 changes: 17 additions & 8 deletions src/main.cpp
Expand Up @@ -39,16 +39,16 @@ libzerocoin::Params* ZCParams;
CBigNum bnProofOfWorkLimit(~uint256(0) >> 20); // "standard" scrypt target limit for proof of work, results with 0,000244140625 proof-of-work difficulty
CBigNum bnProofOfStakeLimit(~uint256(0) >> 20);
CBigNum bnProofOfStakeLimitAfterFork(~uint256(0) >> 12); // allow 256 times lower stake limit after fork
const int forkNum = 8209;
const int forkNum = 13999;
const int DAILY_BLOCKCOUNT = 1440;
const int decStakeForkNum = DAILY_BLOCKCOUNT*30; // first period of halving starts from 30 days from the beginning, @43200, still 100% after this
const int decStakePeriod = DAILY_BLOCKCOUNT*30; // stake is halved every 30 days, first halving at decStakeForkNum + decStakePeriod
const int decStakeForkNum = DAILY_BLOCKCOUNT*60; // first period of halving starts from 60 days from the beginning, @86400, still 100% after this
const int decStakePeriod = DAILY_BLOCKCOUNT*60; // stake is halved every 60 days, first halving at decStakeForkNum + decStakePeriod

CBigNum bnProofOfWorkLimitTestNet(~uint256(0) >> 16);

unsigned int nTargetSpacing = 1 * 60; // 60 seconds
unsigned int nStakeMinAge = 1 * 60 * 60; // 6 hours
unsigned int nStakeMaxAge = 0; // 0 days
unsigned int nStakeMinAge = 8 * 60 * 60; // 8 hours
unsigned int nStakeMaxAge = 60 * 60 * 24 * 20; // 20 days
unsigned int nModifierInterval = 10 * 60; // time to elapse before new modifier is computed

int nCoinbaseMaturity = 100;
Expand Down Expand Up @@ -1017,6 +1017,8 @@ int64_t GetProofOfWorkReward(int64_t nFees)
int64_t GetProofOfStakeReward(int64_t nCoinAge, int64_t nFees, int blockheight)
{
int64_t nRewardCoinYear;
int64_t nSubsidyLimit = 250 * COIN;

if (blockheight <= forkNum) {
nRewardCoinYear = MAX_MINT_PROOF_OF_STAKE;
} else {
Expand All @@ -1027,12 +1029,19 @@ int64_t GetProofOfStakeReward(int64_t nCoinAge, int64_t nFees, int blockheight)
if (nRewardCoinYear < MAX_MINT_PROOF_OF_STAKE) nRewardCoinYear = MAX_MINT_PROOF_OF_STAKE;
}

int64_t nSubsidy = nCoinAge * nRewardCoinYear / 365 / COIN;
nRewardCoinYear = MAX_MINT_PROOF_OF_STAKE_FORKED;

CBigNum bnSubsidy = (CBigNum(nCoinAge) * nRewardCoinYear) / 365 / COIN;

int64_t nSubsidy = bnSubsidy.getuint64();

// nSubsidy = nCoinAge / 365;

if (fDebug && GetBoolArg("-printcreation"))
printf("GetProofOfStakeReward(): create=%s nCoinAge=%"PRId64"\n", FormatMoney(nSubsidy).c_str(), nCoinAge);

nSubsidy = min(nSubsidy, nSubsidyLimit);

return nSubsidy + nFees;
}

Expand Down Expand Up @@ -2159,8 +2168,8 @@ bool CBlock::AcceptBlock()
if (IsProofOfWork() && nHeight > LAST_POW_BLOCK)
return DoS(100, error("AcceptBlock() : reject proof-of-work at height %d", nHeight));

if (IsProofOfStake() && nHeight < MODIFIER_INTERVAL_SWITCH)
return DoS(100, error("AcceptBlock() : reject proof-of-stake at height %d", nHeight));
if (IsProofOfStake() && (nHeight < MODIFIER_INTERVAL_SWITCH || GetBlockTime() < POS_SWITCH_TIME))
return DoS(100, error("AcceptBlock() : reject proof-of-stake at height %d and time %d", nHeight, (int)GetBlockTime()));

// Check proof-of-work or proof-of-stake
if (nBits != GetNextTargetRequired(pindexPrev, IsProofOfStake()))
Expand Down
7 changes: 5 additions & 2 deletions src/main.h
Expand Up @@ -39,10 +39,13 @@ static const int64_t MIN_TX_FEE = 0;
static const int64_t MIN_RELAY_TX_FEE = MIN_TX_FEE;
static const int64_t MAX_MONEY = 5000000 * COIN;
static const int64_t COIN_YEAR_REWARD = 100 * CENT; // 100% per year
static const int64_t MAX_MINT_PROOF_OF_STAKE = 10000 * COIN; // 1% annual interest
static const int64_t MAX_MINT_PROOF_OF_STAKE_FORKED = 10000 * COIN; // 100% annual interest
static const int64_t MAX_MINT_PROOF_OF_STAKE = 0.1 * COIN; // 10% annual interest
static const int64_t MAX_MINT_PROOF_OF_STAKE_FORKED = 1 * COIN; // 100% annual interest
static const int MODIFIER_INTERVAL_SWITCH = 7200;

/** Hard Fork Change Times/Block */
static const unsigned int POS_SWITCH_TIME = 1417784400; // Dec 5 13:00:00 2014 UTC

inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
// Threshold for nLockTime: below this value it is interpreted as block number, otherwise as UNIX timestamp.
static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC
Expand Down
1 change: 1 addition & 0 deletions src/makefile.unix
Expand Up @@ -3,6 +3,7 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

USE_UPNP:=0
USE_IPV6:=1

LINK:=$(CXX)
ARCH:=$(system lscpu | head -n 1 | awk '{print $2}')
Expand Down
4 changes: 2 additions & 2 deletions src/net.cpp
Expand Up @@ -1139,8 +1139,8 @@ void MapPort()
// The first name is used as information source for addrman.
// The second name should resolve to a list of seed addresses.
static const char *strDNSSeed[][2] = {
{"104.236.52.50", "104.236.52.50"},
{"104.236.52.34", "104.236.52.34"},
{"node1", "seednode1.ethereumdark.com"},
{"node2", "seednode2.ethereumdark.com"},
};

void ThreadDNSAddressSeed(void* parg)
Expand Down
4 changes: 0 additions & 4 deletions src/obj/addrman.P

This file was deleted.

6 changes: 0 additions & 6 deletions src/obj/alert.P

This file was deleted.

32 changes: 0 additions & 32 deletions src/obj/bitcoinrpc.P

This file was deleted.

2 changes: 0 additions & 2 deletions src/obj/blake.P

This file was deleted.

2 changes: 0 additions & 2 deletions src/obj/bmw.P

This file was deleted.

2 changes: 0 additions & 2 deletions src/obj/build.h

This file was deleted.

36 changes: 0 additions & 36 deletions src/obj/checkpoints.P

This file was deleted.

6 changes: 0 additions & 6 deletions src/obj/crypter.P

This file was deleted.

2 changes: 0 additions & 2 deletions src/obj/cubehash.P

This file was deleted.

24 changes: 0 additions & 24 deletions src/obj/db.P

This file was deleted.

2 changes: 0 additions & 2 deletions src/obj/echo.P

This file was deleted.

2 changes: 0 additions & 2 deletions src/obj/groestl.P

This file was deleted.

42 changes: 0 additions & 42 deletions src/obj/init.P

This file was deleted.

8 changes: 0 additions & 8 deletions src/obj/irc.P

This file was deleted.

2 changes: 0 additions & 2 deletions src/obj/jh.P

This file was deleted.

2 changes: 0 additions & 2 deletions src/obj/keccak.P

This file was deleted.

0 comments on commit 9dd5c4c

Please sign in to comment.