Skip to content

Commit

Permalink
Disable updatemasternode, and reward address change (#901)
Browse files Browse the repository at this point in the history
* Disable updatemasternode
* Add redundant checks
* Update version
* Disable reward address change
* Update rpcs
  • Loading branch information
prasannavl authored Nov 14, 2021
1 parent cd1c422 commit bbbfd0c
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
9 changes: 9 additions & 0 deletions src/masternodes/masternodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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());
Expand All @@ -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) {
Expand Down
18 changes: 18 additions & 0 deletions src/masternodes/mn_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,25 @@ class CCustomMetadataParseVisitor : public boost::static_visitor<Res>
}

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);
}
Expand Down Expand Up @@ -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());
Expand All @@ -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());
Expand All @@ -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);
}
Expand Down
12 changes: 12 additions & 0 deletions src/masternodes/rpc_masternodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bbbfd0c

Please sign in to comment.