Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove prime controller rates #70

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,10 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, MapPrevTx inputs,
return DoS(100, error("ConnectInputs() : credit doesn't meet requirement for primenode = %lld while you only have %lld", MINIMUM_FOR_PRIMENODE, GetValueOut()));
/* Use time instead of block number because we can better
* control when a manditory wallet update is required. */
if (nTime >= RESET_PRIMERATES) {
if (nTime >= REMOVE_PRIMERATES) {
if (nStakeReward > GetProofOfStakeReward(nCoinAge, 5) - GetMinFee() + MIN_TX_FEE)
return DoS(100, error("ConnectInputs() : %s stake reward exceeded", GetHash().ToString().substr(0,10).c_str()));
} else if (nTime >= RESET_PRIMERATES) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contrary to other peoples discussion we can't remove this second check because it's used when resyncing the blockchain (this obviously applied to every other instance you've done (basically good call on retaining both if statements).

Just a matter of personal preference (not saying it needs to be changed); I would use if instead of else if (it will still be checked in order of top-down) I've had some finicky behavior with else if on other projects. I expect this will work fine but I always feel like sharing random bits like that.

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 {
Expand Down Expand Up @@ -1492,7 +1495,10 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, MapPrevTx inputs,

/* Use time instead of block number because we can better
* control when a manditory wallet update is required. */
if (nTime >= RESET_PRIMERATES) {
if (nTime >= REMOVE_PRIMERATES) {
if (nStakeReward > GetProofOfStakeReward(nCoinAge, 5) - GetMinFee() + MIN_TX_FEE)
return DoS(100, error("ConnectInputs() : %s stake reward exceeded", GetHash().ToString().substr(0,10).c_str()));
} else 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 {
Expand Down Expand Up @@ -1527,7 +1533,10 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, MapPrevTx inputs,
return DoS(100, error("ConnectInputs() : credit doesn't meet requirement for primenode = %lld while you only have %lld", MINIMUM_FOR_PRIMENODE, GetValueOut()));
/* Use time instead of block number because we can better
* control when a manditory wallet update is required. */
if (nTime >= RESET_PRIMERATES) {
if (nTime >= REMOVE_PRIMERATES) {
if (nStakeReward > GetProofOfStakeReward(nCoinAge, 5) - GetMinFee() + MIN_TX_FEE)
return DoS(100, error("ConnectInputs() : %s stake reward exceeded", GetHash().ToString().substr(0,10).c_str()));
} else 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 {
Expand Down
1 change: 1 addition & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ 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 = 1429531200; // Mon, 20 Apr 2015 12:00:00 GMT
static const unsigned int REMOVE_PRIMERATES = 1430097333; // May 6, 2015 at 6:14:35 GMT

#ifdef USE_UPNP
static const int fHaveUPnP = true;
Expand Down
4 changes: 3 additions & 1 deletion src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,9 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int
return error("CreateCoinStake : Primenode rate configuration is wrong or missing");
}

if (txNew.nTime >= RESET_PRIMERATES) {
if (txNew.nTime >= REMOVE_PRIMERATES) {
primeNodeRate = 5;
} else if (txNew.nTime >= RESET_PRIMERATES) {
primeNodeRate = 100;
}

Expand Down