Skip to content

Commit

Permalink
Change all stakerates to 100% after Mon, 06 Apr 2015 12:00:00 GMT
Browse files Browse the repository at this point in the history
* This will force change the rate from whatever it is configured at to 100%
* No config changes should be made in the .conf regarding staking rate
  • Loading branch information
IngCr3at1on committed Apr 9, 2015
1 parent 122e274 commit 2abed74
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
37 changes: 30 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1418,8 +1418,15 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, MapPrevTx inputs,
return DoS(10, error("CTransaction::ConnectInputs() : verify signature failed"));
if (GetValueOut() < MINIMUM_FOR_PRIMENODE)
return DoS(100, error("ConnectInputs() : credit doesn't meet requirement for primenode = %lld while you only have %lld", MINIMUM_FOR_PRIMENODE, GetValueOut()));
if (nStakeReward > GetProofOfStakeReward(nCoinAge, 350) - GetMinFee() + MIN_TX_FEE)
return DoS(100, error("ConnectInputs() : %s stake reward exceeded", GetHash().ToString().substr(0,10).c_str()));
/* Use time instead of block number because we can better
* control when a manditory wallet update is required. */
if (nTime >= RESET_PRIMERATES) {
if (nStakeReward > GetProofOfStakeReward(nCoinAge, 100) - GetMinFee() + MIN_TX_FEE)
return DoS(100, error("ConnectInputs() : %s stake reward exceeded", GetHash().ToString().substr(0,10).c_str()));
} else {
if (nStakeReward > GetProofOfStakeReward(nCoinAge, 350) - GetMinFee() + MIN_TX_FEE)
return DoS(100, error("ConnectInputs() : %s stake reward exceeded", GetHash().ToString().substr(0,10).c_str()));
}

}else if (!vout[0].IsEmpty() && vout[0].scriptPubKey[0] == OP_PRIMENODE100){
std::vector<string> pubKeyList;
Expand Down Expand Up @@ -1453,7 +1460,8 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, MapPrevTx inputs,
return DoS(10, error("CTransaction::ConnectInputs() : verify signature failed"));
if (GetValueOut() < MINIMUM_FOR_PRIMENODE)
return DoS(100, error("ConnectInputs() : credit doesn't meet requirement for primenode = %lld while you only have %lld", MINIMUM_FOR_PRIMENODE, GetValueOut()));
if (nStakeReward > GetProofOfStakeReward(nCoinAge, 100) - GetMinFee() + MIN_TX_FEE)
// No need to adjust as this is already at 100.
if (nStakeReward > GetProofOfStakeReward(nCoinAge, 100) - GetMinFee() + MIN_TX_FEE)
return DoS(100, error("ConnectInputs() : %s stake reward exceeded", GetHash().ToString().substr(0,10).c_str()));

}else if (!vout[0].IsEmpty() && vout[0].scriptPubKey[0] == OP_PRIMENODE20){
Expand Down Expand Up @@ -1481,8 +1489,16 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, MapPrevTx inputs,
return DoS(10, error("CTransaction::ConnectInputs() : verify signature failed"));
if (GetValueOut() < MINIMUM_FOR_PRIMENODE)
return DoS(100, error("ConnectInputs() : credit doesn't meet requirement for primenode = %lld while you only have %lld", MINIMUM_FOR_PRIMENODE, GetValueOut()));
if (nStakeReward > GetProofOfStakeReward(nCoinAge, 20) - GetMinFee() + MIN_TX_FEE)
return DoS(100, error("ConnectInputs() : %s stake reward exceeded", GetHash().ToString().substr(0,10).c_str()));

/* Use time instead of block number because we can better
* control when a manditory wallet update is required. */
if (nTime >= RESET_PRIMERATES) {
if (nStakeReward > GetProofOfStakeReward(nCoinAge, 100) - GetMinFee() + MIN_TX_FEE)
return DoS(100, error("ConnectInputs() : %s stake reward exceeded", GetHash().ToString().substr(0,10).c_str()));
} else {
if (nStakeReward > GetProofOfStakeReward(nCoinAge, 20) - GetMinFee() + MIN_TX_FEE)
return DoS(100, error("ConnectInputs() : %s stake reward exceeded", GetHash().ToString().substr(0,10).c_str()));
}

}else if (!vout[0].IsEmpty() && vout[0].scriptPubKey[0] == OP_PRIMENODE10){
std::vector<string> pubKeyList;
Expand All @@ -1509,8 +1525,15 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, MapPrevTx inputs,
return DoS(10, error("CTransaction::ConnectInputs() : verify signature failed"));
if (GetValueOut() < MINIMUM_FOR_PRIMENODE)
return DoS(100, error("ConnectInputs() : credit doesn't meet requirement for primenode = %lld while you only have %lld", MINIMUM_FOR_PRIMENODE, GetValueOut()));
if (nStakeReward > GetProofOfStakeReward(nCoinAge, 10) - GetMinFee() + MIN_TX_FEE)
return DoS(100, error("ConnectInputs() : %s stake reward exceeded", GetHash().ToString().substr(0,10).c_str()));
/* Use time instead of block number because we can better
* control when a manditory wallet update is required. */
if (nTime >= RESET_PRIMERATES) {
if (nStakeReward > GetProofOfStakeReward(nCoinAge, 100) - GetMinFee() + MIN_TX_FEE)
return DoS(100, error("ConnectInputs() : %s stake reward exceeded", GetHash().ToString().substr(0,10).c_str()));
} else {
if (nStakeReward > GetProofOfStakeReward(nCoinAge, 10) - GetMinFee() + MIN_TX_FEE)
return DoS(100, error("ConnectInputs() : %s stake reward exceeded", GetHash().ToString().substr(0,10).c_str()));
}

}else if (vout[0].IsEmpty()) {
if(GetValueOut() <= MINIMUM_FOR_ORION){
Expand Down
3 changes: 2 additions & 1 deletion src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ static const int64 NUMBER_OF_PRIMENODE = 50;
static const int64 MINIMUM_FOR_ORION = 50 * COIN;
static const int64 MINIMUM_FOR_PRIMENODE = 125000 * COIN;
static const int MAX_TIME_SINCE_BEST_BLOCK = 10; // how many seconds to wait before sending next PushGetBlocks()

// Reset all primenode stakerates to 100% after the given date
static const unsigned int RESET_PRIMERATES = 1428321600; // Mon, 06 Apr 2015 12:00:00 GMT

#ifdef USE_UPNP
static const int fHaveUPnP = true;
Expand Down

0 comments on commit 2abed74

Please sign in to comment.