Skip to content

Commit

Permalink
coin burn
Browse files Browse the repository at this point in the history
  • Loading branch information
mclxi committed Jun 15, 2018
1 parent 5eafac8 commit dd6ab9e
Show file tree
Hide file tree
Showing 23 changed files with 448 additions and 90 deletions.
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 1)
define(_CLIENT_VERSION_MINOR, 4)
define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_BUILD, 1)
define(_CLIENT_VERSION_MINOR, 5)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2017)
define(_COPYRIGHT_HOLDERS,[The %s developers])
Expand Down
6 changes: 4 additions & 2 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class CMainParams : public CChainParams {
consensus.nBudgetPaymentsStartBlock = 32800; // actual historical value
consensus.nBudgetPaymentsCycleBlocks = 16616; // ~(60*24*30)/2.6, actual number of blocks per month is 200700 / 12 = 16725
consensus.nBudgetPaymentsWindowBlocks = 100;
consensus.nSuperblockStartBlock = 6646384784; // The block at which 12.1 goes live (end of final 12.0 budget cycle)
consensus.nSuperblockStartBlock = 66384784; // The block at which 12.1 goes live (end of final 12.0 budget cycle)
consensus.nSuperblockCycle = 16616; // ~(60*24*30)/2.6, actual number of blocks per month is 200700 / 12 = 16725
consensus.nSuperblockStartHash = uint256S("0000000000000a7d13390bb29ac6d4466afb16358aeb3cd0656215392ed2468d");
consensus.nGovernanceMinQuorum = 10;
Expand All @@ -144,6 +144,8 @@ class CMainParams : public CChainParams {
consensus.BIP66Height = 245817; // 00000000000b1fa2dfa312863570e13fae9ca7b5566cb27e55422620b469aefa
consensus.DIP0001Height = 782208;
consensus.powLimit = uint256S("00000fffff000000000000000000000000000000000000000000000000000000");
//consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1

consensus.nPowTargetTimespan = 120; // aced: 120 seconds
consensus.nPowTargetSpacing = 120 ; // aced: 2.5 minutes
consensus.fPowAllowMinDifficultyBlocks = false;
Expand Down Expand Up @@ -220,7 +222,7 @@ class CMainParams : public CChainParams {

vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));

fMiningRequiresPeers = true;
fMiningRequiresPeers = false;
fDefaultConsistencyChecks = false;
fRequireStandard = true;
fMineBlocksOnDemand = false;
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

static const int CLIENT_VERSION =
1000000 * CLIENT_VERSION_MAJOR
+ 10000 * 4
+ 10000 * 5
+ 100 * 1
+ 1 * 1;

Expand Down
4 changes: 2 additions & 2 deletions src/governance-object.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ class CGovernanceObject
READWRITE(nRevision);
READWRITE(nTime);
READWRITE(nCollateralHash);
if (nVersion == 70209 && (s.GetType() & SER_NETWORK)) {
if (nVersion >= 70209 && (s.GetType() & SER_NETWORK)) {
// converting from/to old format
std::string strDataHex;
if (ser_action.ForRead()) {
Expand All @@ -325,7 +325,7 @@ class CGovernanceObject
READWRITE(vchData);
}
READWRITE(nObjectType);
if (nVersion == 70209 && (s.GetType() & SER_NETWORK)) {
if (nVersion >= 70209 && (s.GetType() & SER_NETWORK)) {
// converting from/to old format
CTxIn txin;
if (ser_action.ForRead()) {
Expand Down
2 changes: 1 addition & 1 deletion src/governance-vote.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class CGovernanceVote
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
int nVersion = s.GetVersion();
if (nVersion == 70209 && (s.GetType() & SER_NETWORK)) {
if (nVersion >= 70209 && (s.GetType() & SER_NETWORK)) {
// converting from/to old format
CTxIn txin{};
if (ser_action.ForRead()) {
Expand Down
29 changes: 25 additions & 4 deletions src/instantx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,17 @@ void CInstantSend::ProcessMessage(CNode* pfrom, const std::string& strCommand, C

if (strCommand == NetMsgType::TXLOCKVOTE) // InstantSend Transaction Lock Consensus Votes
{
if(pfrom->nVersion < MIN_INSTANTSEND_PROTO_VERSION) {
int catcher;
if (chainActive.Height() < 17170){
catcher=70209;
}else {
catcher=70210;
}

if(pfrom->nVersion < catcher) {
LogPrint("instantsend", "TXLOCKVOTE -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion);
connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE,
strprintf("Version must be %d or greater", MIN_INSTANTSEND_PROTO_VERSION)));
strprintf("Version must be %d or greater", catcher)));
return;
}

Expand Down Expand Up @@ -233,7 +240,14 @@ void CInstantSend::Vote(CTxLockCandidate& txLockCandidate, CConnman& connman)
int nLockInputHeight = nPrevoutHeight + Params().GetConsensus().nInstantSendConfirmationsRequired - 2;

int nRank;
if(!mnodeman.GetMasternodeRank(activeMasternode.outpoint, nRank, nLockInputHeight, MIN_INSTANTSEND_PROTO_VERSION)) {
int catcher;
if (chainActive.Height() < 17170){
catcher=70209;
}else {
catcher=70210;
}

if(!mnodeman.GetMasternodeRank(activeMasternode.outpoint, nRank, nLockInputHeight, catcher)) {
LogPrint("instantsend", "CInstantSend::Vote -- Can't calculate rank for masternode %s\n", activeMasternode.outpoint.ToStringShort());
++itOutpointLock;
continue;
Expand Down Expand Up @@ -1041,7 +1055,14 @@ bool CTxLockVote::IsValid(CNode* pnode, CConnman& connman) const
int nLockInputHeight = coin.nHeight + Params().GetConsensus().nInstantSendConfirmationsRequired - 2;

int nRank;
if(!mnodeman.GetMasternodeRank(outpointMasternode, nRank, nLockInputHeight, MIN_INSTANTSEND_PROTO_VERSION)) {
int catcher;
if (chainActive.Height() < 17170){
catcher=70209;
}else {
catcher=70210;
}

if(!mnodeman.GetMasternodeRank(outpointMasternode, nRank, nLockInputHeight, catcher)) {
//can be caused by past versions trying to vote with an invalid protocol
LogPrint("instantsend", "CTxLockVote::IsValid -- Can't calculate rank for masternode %s\n", outpointMasternode.ToStringShort());
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/masternode-payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void CMasternodePayments::ProcessMessage(CNode* pfrom, const std::string& strCom
if (!masternodeSync.IsSynced()) return;

// DEPRECATED, should be removed on next protocol bump
if(pfrom->nVersion == 70209) {
if(pfrom->nVersion == 70209 || pfrom->nVersion == 70210) {
int nCountNeeded;
vRecv >> nCountNeeded;
}
Expand Down
4 changes: 2 additions & 2 deletions src/masternode-payments.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ static const int MNPAYMENTS_SIGNATURES_TOTAL = 10;
// vote for masternode and be elected as a payment winner
// V1 - Last protocol version before update
// V2 - Newest protocol version
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1 = 70206;
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2 = 70209;
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1 = 70209;
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2 = 70210;

extern CCriticalSection cs_vecPayees;
extern CCriticalSection cs_mapMasternodeBlocks;
Expand Down
4 changes: 2 additions & 2 deletions src/masternode-sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void CMasternodeSync::ProcessTick(CConnman& connman)
mnodeman.DsegUpdate(pnode, connman);
} else if(nRequestedMasternodeAttempt < 6) {
//sync payment votes
if(pnode->nVersion == 70209) {
if(pnode->nVersion == 70209 || pnode->nVersion == 70210) {
connman.PushMessage(pnode, msgMaker.Make(NetMsgType::MASTERNODEPAYMENTSYNC, mnpayments.GetStorageLimit())); //sync payment votes
} else {
connman.PushMessage(pnode, msgMaker.Make(NetMsgType::MASTERNODEPAYMENTSYNC)); //sync payment votes
Expand Down Expand Up @@ -325,7 +325,7 @@ void CMasternodeSync::ProcessTick(CConnman& connman)

// ask node for all payment votes it has (new nodes will only return votes for future payments)
//sync payment votes
if(pnode->nVersion == 70209) {
if(pnode->nVersion == 70209 || pnode->nVersion == 70210) {
connman.PushMessage(pnode, msgMaker.Make(NetMsgType::MASTERNODEPAYMENTSYNC, mnpayments.GetStorageLimit()));
} else {
connman.PushMessage(pnode, msgMaker.Make(NetMsgType::MASTERNODEPAYMENTSYNC));
Expand Down
10 changes: 5 additions & 5 deletions src/masternode.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CMasternodePing
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
int nVersion = s.GetVersion();
if (nVersion == 70209 && (s.GetType() & SER_NETWORK)) {
if (nVersion >= 70209 && (s.GetType() & SER_NETWORK)) {
// converting from/to old format
CTxIn txin{};
if (ser_action.ForRead()) {
Expand Down Expand Up @@ -85,7 +85,7 @@ class CMasternodePing
nDaemonVersion = DEFAULT_DAEMON_VERSION;
return;
}
if (!(nVersion == 70209 && (s.GetType() & SER_NETWORK))) {
if (!(nVersion >= 70209 && (s.GetType() & SER_NETWORK))) {
READWRITE(nDaemonVersion);
}
}
Expand Down Expand Up @@ -204,7 +204,7 @@ class CMasternode : public masternode_info_t
inline void SerializationOp(Stream& s, Operation ser_action) {
LOCK(cs);
int nVersion = s.GetVersion();
if (nVersion == 70209 && (s.GetType() & SER_NETWORK)) {
if (nVersion >= 70209 && (s.GetType() & SER_NETWORK)) {
// converting from/to old format
CTxIn txin{};
if (ser_action.ForRead()) {
Expand Down Expand Up @@ -362,7 +362,7 @@ class CMasternodeBroadcast : public CMasternode
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
int nVersion = s.GetVersion();
if (nVersion == 70209 && (s.GetType() & SER_NETWORK)) {
if (nVersion >= 70209 && (s.GetType() & SER_NETWORK)) {
// converting from/to old format
CTxIn txin{};
if (ser_action.ForRead()) {
Expand Down Expand Up @@ -429,7 +429,7 @@ class CMasternodeVerification
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
int nVersion = s.GetVersion();
if (nVersion == 70209 && (s.GetType() & SER_NETWORK)) {
if (nVersion >= 70209 && (s.GetType() & SER_NETWORK)) {
// converting from/to old format
CTxIn txin1{};
CTxIn txin2{};
Expand Down
6 changes: 3 additions & 3 deletions src/masternodeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void CMasternodeMan::AskForMN(CNode* pnode, const COutPoint& outpoint, CConnman&
}
mWeAskedForMasternodeListEntry[outpoint][addrSquashed] = GetTime() + DSEG_UPDATE_SECONDS;

if (pnode->GetSendVersion() == 70209) {
if (pnode->GetSendVersion() == 70209 || pnode->GetSendVersion() == 70210) {
connman.PushMessage(pnode, msgMaker.Make(NetMsgType::DSEG, CTxIn(outpoint)));
} else {
connman.PushMessage(pnode, msgMaker.Make(NetMsgType::DSEG, outpoint));
Expand Down Expand Up @@ -430,7 +430,7 @@ void CMasternodeMan::DsegUpdate(CNode* pnode, CConnman& connman)
}
}

if (pnode->GetSendVersion() == 70209) {
if (pnode->GetSendVersion() == 70209 || pnode->GetSendVersion() == 70210) {
connman.PushMessage(pnode, msgMaker.Make(NetMsgType::DSEG, CTxIn()));
} else {
connman.PushMessage(pnode, msgMaker.Make(NetMsgType::DSEG, COutPoint()));
Expand Down Expand Up @@ -884,7 +884,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, const std::string& strCommand,

COutPoint masternodeOutpoint;

if (pfrom->nVersion == 70209) {
if (pfrom->nVersion == 70209 || pfrom->nVersion == 70210) {
CTxIn vin;
vRecv >> vin;
masternodeOutpoint = vin.prevout;
Expand Down
8 changes: 7 additions & 1 deletion src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2612,8 +2612,14 @@ void CConnman::RelayTransaction(const CTransaction& tx)

void CConnman::RelayInv(CInv &inv, const int minProtoVersion) {
LOCK(cs_vNodes);
int minproto;
if (chainActive.Height() < 17170) {
minproto = 70209;
} else {
minproto = 70210;
}
for (const auto& pnode : vNodes)
if(pnode->nVersion >= minProtoVersion)
if(pnode->nVersion >= minproto)
pnode->PushInventory(inv);
}

Expand Down
11 changes: 8 additions & 3 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1208,13 +1208,18 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
pfrom->fDisconnect = true;
return false;
}
//if (nTime > 1527292800) { //friday may 25 00:00:00 GMT
if (nVersion < MIN_PEER_PROTO_VERSION)
int minproto;
if (chainActive.Height() < 17170) { //friday may 25 00:00:00 GMT
minproto=70209;
} else {
minproto=70210;
}
if (nVersion < minproto)
{
// disconnect from peers older than this proto version
LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, nVersion);
connman.PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE,
strprintf("Version must be %d or greater", MIN_PEER_PROTO_VERSION)));
strprintf("Version must be %d or greater", minproto)));
pfrom->fDisconnect = true;
return false;
}
Expand Down

0 comments on commit dd6ab9e

Please sign in to comment.