From bbbfd0c7ba0ced0d3890911f1675b0d268a2fd1c Mon Sep 17 00:00:00 2001 From: Prasanna Loganathar Date: Sun, 14 Nov 2021 20:34:37 +0530 Subject: [PATCH] Disable updatemasternode, and reward address change (#901) * Disable updatemasternode * Add redundant checks * Update version * Disable reward address change * Update rpcs --- configure.ac | 2 +- src/masternodes/masternodes.cpp | 9 +++++++++ src/masternodes/mn_checks.cpp | 18 ++++++++++++++++++ src/masternodes/rpc_masternodes.cpp | 12 ++++++++++++ src/version.h | 2 +- 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 070432a8643..9d545567d83 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 2) -define(_CLIENT_VERSION_MINOR, 1) +define(_CLIENT_VERSION_MINOR, 2) define(_CLIENT_VERSION_REVISION, 0) define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_RC, 0) diff --git a/src/masternodes/masternodes.cpp b/src/masternodes/masternodes.cpp index c911937ab00..a7c34fded72 100644 --- a/src/masternodes/masternodes.cpp +++ b/src/masternodes/masternodes.cpp @@ -325,6 +325,9 @@ Res CMasternodesView::ResignMasternode(const uint256 & nodeId, const uint256 & t Res CMasternodesView::SetForcedRewardAddress(uint256 const & nodeId, const char rewardAddressType, CKeyID const & rewardAddress, int height) { + // Temporarily disabled for 2.2 + return Res::Err("reward address change is disabled for Fort Canning"); + auto node = GetMasternode(nodeId); if (!node) { return Res::Err("masternode %s does not exists", nodeId.ToString()); @@ -349,6 +352,9 @@ Res CMasternodesView::SetForcedRewardAddress(uint256 const & nodeId, const char Res CMasternodesView::RemForcedRewardAddress(uint256 const & nodeId, int height) { + // Temporarily disabled for 2.2 + return Res::Err("reward address change is disabled for Fort Canning"); + auto node = GetMasternode(nodeId); if (!node) { return Res::Err("masternode %s does not exists", nodeId.ToString()); @@ -366,6 +372,9 @@ Res CMasternodesView::RemForcedRewardAddress(uint256 const & nodeId, int height) } Res CMasternodesView::UpdateMasternode(uint256 const & nodeId, char operatorType, const CKeyID& operatorAuthAddress, int height) { + // Temporarily disabled for 2.2 + return Res::Err("updatemasternode is disabled for Fort Canning"); + // auth already checked! auto node = GetMasternode(nodeId); if (!node) { diff --git a/src/masternodes/mn_checks.cpp b/src/masternodes/mn_checks.cpp index aefcb5812ff..0d1967a4f58 100644 --- a/src/masternodes/mn_checks.cpp +++ b/src/masternodes/mn_checks.cpp @@ -238,16 +238,25 @@ class CCustomMetadataParseVisitor : public boost::static_visitor } Res operator()(CSetForcedRewardAddressMessage& obj) const { + // Temporarily disabled for 2.2 + return Res::Err("reward address change is disabled for Fort Canning"); + auto res = isPostFortCanningFork(); return !res ? res : serialize(obj); } Res operator()(CRemForcedRewardAddressMessage& obj) const { + // Temporarily disabled for 2.2 + return Res::Err("reward address change is disabled for Fort Canning"); + auto res = isPostFortCanningFork(); return !res ? res : serialize(obj); } Res operator()(CUpdateMasterNodeMessage& obj) const { + // Temporarily disabled for 2.2 + return Res::Err("updatemasternode is disabled for Fort Canning"); + auto res = isPostFortCanningFork(); return !res ? res : serialize(obj); } @@ -913,6 +922,9 @@ class CCustomTxApplyVisitor : public CCustomTxVisitor } Res operator()(const CSetForcedRewardAddressMessage& obj) const { + // Temporarily disabled for 2.2 + return Res::Err("reward address change is disabled for Fort Canning"); + auto const node = mnview.GetMasternode(obj.nodeId); if (!node) { return Res::Err("masternode %s does not exist", obj.nodeId.ToString()); @@ -925,6 +937,9 @@ class CCustomTxApplyVisitor : public CCustomTxVisitor } Res operator()(const CRemForcedRewardAddressMessage& obj) const { + // Temporarily disabled for 2.2 + return Res::Err("reward address change is disabled for Fort Canning"); + auto const node = mnview.GetMasternode(obj.nodeId); if (!node) { return Res::Err("masternode %s does not exist", obj.nodeId.ToString()); @@ -937,6 +952,9 @@ class CCustomTxApplyVisitor : public CCustomTxVisitor } Res operator()(const CUpdateMasterNodeMessage& obj) const { + // Temporarily disabled for 2.2 + return Res::Err("updatemasternode is disabled for Fort Canning"); + auto res = HasCollateralAuth(obj.mnId); return !res ? res : mnview.UpdateMasternode(obj.mnId, obj.operatorType, obj.operatorAuthAddress, height); } diff --git a/src/masternodes/rpc_masternodes.cpp b/src/masternodes/rpc_masternodes.cpp index 9ffcf1d0ea3..ca4adfa14bc 100644 --- a/src/masternodes/rpc_masternodes.cpp +++ b/src/masternodes/rpc_masternodes.cpp @@ -207,6 +207,10 @@ UniValue createmasternode(const JSONRPCRequest& request) UniValue setforcedrewardaddress(const JSONRPCRequest& request) { + // Temporarily disabled for 2.2 + throw JSONRPCError(RPC_INVALID_REQUEST, + "reward address change is disabled for Fort Canning"); + auto pwallet = GetWallet(request); RPCHelpMan{"setforcedrewardaddress", @@ -311,6 +315,10 @@ UniValue setforcedrewardaddress(const JSONRPCRequest& request) UniValue remforcedrewardaddress(const JSONRPCRequest& request) { + // Temporarily disabled for 2.2 + throw JSONRPCError(RPC_INVALID_REQUEST, + "reward address change is disabled for Fort Canning"); + auto pwallet = GetWallet(request); RPCHelpMan{"remforcedrewardaddress", @@ -490,6 +498,10 @@ UniValue resignmasternode(const JSONRPCRequest& request) UniValue updatemasternode(const JSONRPCRequest& request) { + // Temporarily disabled for 2.2 + throw JSONRPCError(RPC_INVALID_REQUEST, + "updatemasternode is disabled for Fort Canning"); + auto pwallet = GetWallet(request); RPCHelpMan{"updatemasternode", diff --git a/src/version.h b/src/version.h index 51161647f05..de61d7e4a08 100644 --- a/src/version.h +++ b/src/version.h @@ -9,7 +9,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 70021; +static const int PROTOCOL_VERSION = 70022; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209;