Skip to content

Commit

Permalink
Merge pull request #207 from zcoinofficial/znode-v90025
Browse files Browse the repository at this point in the history
Set minimum accepted protocol is 90024 for znode
  • Loading branch information
sn-ntu authored May 20, 2018
2 parents ca2f494 + 2406dfb commit 5a54542
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/activeznode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "consensus/consensus.h"
#include "znode.h"
#include "znode-sync.h"
#include "znode-payments.h"
#include "znodeman.h"
#include "protocol.h"

Expand Down Expand Up @@ -250,10 +251,9 @@ void CActiveZnode::ManageStateRemote() {
mnodeman.CheckZnode(pubKeyZnode);
znode_info_t infoMn = mnodeman.GetZnodeInfo(pubKeyZnode);

int nHeight = chainActive.Height();
if (infoMn.fInfoValid) {
if (infoMn.nProtocolVersion < MIN_PEER_PROTO_VERSION
|| (nHeight > ZC_MODULUS_V2_START_BLOCK && infoMn.nProtocolVersion < PROTOCOL_VERSION)) {
if (infoMn.nProtocolVersion < MIN_ZNODE_PAYMENT_PROTO_VERSION_1
|| infoMn.nProtocolVersion > MIN_ZNODE_PAYMENT_PROTO_VERSION_2) {
nState = ACTIVE_ZNODE_NOT_CAPABLE;
strNotCapableReason = "Invalid protocol version";
LogPrintf("CActiveZnode::ManageStateRemote -- %s: %s\n", GetStateString(), strNotCapableReason);
Expand Down
4 changes: 2 additions & 2 deletions src/znode-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 znode and be elected as a payment winner
// V1 - Last protocol version before update
// V2 - Newest protocol version
static const int MIN_ZNODE_PAYMENT_PROTO_VERSION_1 = 90023;
static const int MIN_ZNODE_PAYMENT_PROTO_VERSION_2 = 90024;
static const int MIN_ZNODE_PAYMENT_PROTO_VERSION_1 = 90024;
static const int MIN_ZNODE_PAYMENT_PROTO_VERSION_2 = 90025;

extern CCriticalSection cs_vecPayees;
extern CCriticalSection cs_mapZnodeBlocks;
Expand Down
6 changes: 2 additions & 4 deletions src/znode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,7 @@ void CZnode::Check(bool fForce) {
// znode doesn't meet payment protocol requirements ...
bool fRequireUpdate = nProtocolVersion < mnpayments.GetMinZnodePaymentsProto() ||
// or it's our own node and we just updated it to the new protocol but we are still waiting for activation ...
(fOurZnode &&
(nProtocolVersion < MIN_PEER_PROTO_VERSION
|| (nHeight > ZC_MODULUS_V2_START_BLOCK && nProtocolVersion < PROTOCOL_VERSION)));
(fOurZnode && (nProtocolVersion < MIN_ZNODE_PAYMENT_PROTO_VERSION_1 || nProtocolVersion > MIN_ZNODE_PAYMENT_PROTO_VERSION_2));

if (fRequireUpdate) {
nActiveState = ZNODE_UPDATE_REQUIRED;
Expand Down Expand Up @@ -508,7 +506,7 @@ bool CZnodeBroadcast::Create(CTxIn txin, CService service, CKey keyCollateralAdd
}

int nHeight = chainActive.Height();
if (nHeight <= ZC_MODULUS_V2_START_BLOCK) {
if (nHeight < ZC_MODULUS_V2_START_BLOCK) {
mnbRet = CZnodeBroadcast(service, txin, pubKeyCollateralAddressNew, pubKeyZnodeNew, MIN_PEER_PROTO_VERSION);
} else {
mnbRet = CZnodeBroadcast(service, txin, pubKeyCollateralAddressNew, pubKeyZnodeNew, PROTOCOL_VERSION);
Expand Down

0 comments on commit 5a54542

Please sign in to comment.