Skip to content

Commit

Permalink
OK v2.0.0.2 core m
Browse files Browse the repository at this point in the history
  • Loading branch information
oktoshi committed Nov 30, 2016
1 parent a71775d commit 4fad7c7
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion okcash-qt.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TEMPLATE = app
TARGET = okcash-qt
VERSION = 2.0.0.1
VERSION = 2.0.0.2
INCLUDEPATH += src src/json src/qt src/qt/plugins/mrichtexteditor
DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE
CONFIG += no_include_pwd
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define CLIENT_VERSION_MAJOR 2
#define CLIENT_VERSION_MINOR 0
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 1
#define CLIENT_VERSION_BUILD 2

// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
Expand Down
15 changes: 12 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -984,9 +984,18 @@ int64_t GetProofOfWorkReward(int nHeight, int64_t nFees)
}

// miner's coin stake reward based on coin age spent (coin-days)
int64_t GetProofOfStakeReward(int64_t nCoinAge, int64_t nFees)
int64_t GetProofOfStakeReward(int nHeight, int64_t nCoinAge, int64_t nFees)
{
int64_t nSubsidy = nCoinAge * COIN_YEAR_REWARD * 33 / (365 * 33 + 8);
int64_t nSubsidy = nCoinAge * KCOIN_YEAR_REWARD * 33 / (365 * 33 + 8);

if (nHeight <= FIRSY_BLOCK)
nSubsidy = nCoinAge * COIN_YEAR_REWARD * 33 / (365 * 33 + 8);
else
if (nHeight <= SECOY_BLOCK)
nSubsidy = nCoinAge * SCOIN_YEAR_REWARD * 33 / (365 * 33 + 8);
else
if (nHeight <= THIRY_BLOCK)
nSubsidy = nCoinAge * CCOIN_YEAR_REWARD * 33 / (365 * 33 + 8);

if (fDebug && GetBoolArg("-printcreation"))
printf("GetProofOfStakeReward(): create=%s nCoinAge=%"PRId64"\n", FormatMoney(nSubsidy).c_str(), nCoinAge);
Expand Down Expand Up @@ -1522,7 +1531,7 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex, bool fJustCheck)
if (!vtx[1].GetCoinAge(txdb, nCoinAge))
return error("ConnectBlock() : %s unable to get coin age for coinstake", vtx[1].GetHash().ToString().substr(0,10).c_str());

int64_t nCalculatedStakeReward = GetProofOfStakeReward(nCoinAge, nFees);
int64_t nCalculatedStakeReward = GetProofOfStakeReward(pindex->nHeight, nCoinAge, nFees);

if (nStakeReward > nCalculatedStakeReward)
return DoS(100, error("ConnectBlock() : coinstake pays too much(actual=%"PRId64" vs calculated=%"PRId64")", nStakeReward, nCalculatedStakeReward));
Expand Down
10 changes: 8 additions & 2 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class CInv;
class CRequestTracker;
class CNode;

static const int THIRY_BLOCK = 1523771; // + 1 year blocks average
static const int SECOY_BLOCK = 1022514; // + 1 year blocks average
static const int FIRSY_BLOCK = 521257; // 501257 blocks/year + 20000 blocks (15 days) first year
static const int LAST_POW_BLOCK = 33186;
static const int LAST_FAIR_LAUNCH_BLOCK = 30;
static const int DEV_FUND_BLOCK = 1;
Expand All @@ -37,7 +40,10 @@ static const unsigned int MAX_INV_SZ = 50000;
static const int64_t MIN_TX_FEE = 10000;
static const int64_t MIN_RELAY_TX_FEE = MIN_TX_FEE;
static const int64_t MAX_MONEY = 105000000 * COIN; // 105 million OKCash Total
static const int64_t COIN_YEAR_REWARD = 69 * CENT; // 69% 1st Year : 20% 2nd : 10% 3rd : 6% 4th onwards
static const int64_t COIN_YEAR_REWARD = 69 * CENT; // 69% 1st Year
static const int64_t SCOIN_YEAR_REWARD = 20 * CENT; // 20% 2nd Year
static const int64_t CCOIN_YEAR_REWARD = 10 * CENT; // 10% 3rd Year
static const int64_t KCOIN_YEAR_REWARD = 6 * CENT; // 6% 4th Year and onwards

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.
Expand Down Expand Up @@ -110,7 +116,7 @@ bool LoadExternalBlockFile(FILE* fileIn);
bool CheckProofOfWork(uint256 hash, unsigned int nBits);
unsigned int GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfStake);
int64_t GetProofOfWorkReward(int nHeight, int64_t nFees);
int64_t GetProofOfStakeReward(int64_t nCoinAge, int64_t nFees);
int64_t GetProofOfStakeReward(int nHeight, int64_t nCoinAge, int64_t nFees);
unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime);
unsigned int ComputeMinStake(unsigned int nBase, int64_t nTime, unsigned int nBlockTime);
int GetNumBlocksOfPeers();
Expand Down
Binary file modified src/qt/res/images/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static const int DATABASE_VERSION = 70509;
// network protocol versioning
//

static const int PROTOCOL_VERSION = 60014;
static const int PROTOCOL_VERSION = 60015;

// intial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
Expand Down
4 changes: 3 additions & 1 deletion src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2570,10 +2570,12 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int
{
uint64_t nCoinAge;
CTxDB txdb("r");
const CBlockIndex* pIndex0 = GetLastBlockIndex(pindexBest, false);

if (!txNew.GetCoinAge(txdb, nCoinAge))
return error("CreateCoinStake : failed to calculate coin age");

int64_t nReward = GetProofOfStakeReward(nCoinAge, nFees);
int64_t nReward = GetProofOfStakeReward(pIndex0->nHeight, nCoinAge, nFees);
if (nReward <= 0)
return false;

Expand Down

0 comments on commit 4fad7c7

Please sign in to comment.