-
Notifications
You must be signed in to change notification settings - Fork 118
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
Add custom reward address to createmasternode
RPC
#1941
Conversation
createmasternode
createmasternode
createmasternode
RPC
src/masternodes/mn_checks.cpp
Outdated
@@ -820,6 +820,10 @@ class CCustomTxApplyVisitor : public CCustomTxVisitor { | |||
node.creationHeight = height; | |||
node.operatorType = obj.operatorType; | |||
node.operatorAuthAddress = obj.operatorAuthAddress; | |||
if (height >= static_cast<uint32_t>(consensus.NextNetworkUpgradeHeight)) { | |||
node.rewardAddressType = obj.rewardType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In CMasternodesView::CreateMasternode add checks that the type is either NoDestType, PKHashType, ScriptHashType or WitV0KeyHashType, so 0, 1, 2 or 4.
src/masternodes/rpc_masternodes.cpp
Outdated
@@ -165,7 +174,12 @@ UniValue createmasternode(const JSONRPCRequest& request) | |||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Address (%s) is not owned by the wallet", EncodeDestination(ownerDest))); | |||
} | |||
|
|||
if (rewardDest.index() != 1 && rewardDest.index() != 4) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this check and let it happen on the consensus side. Reward will include type 2 as well on the next hard fork due to PR 1664.
src/masternodes/rpc_masternodes.cpp
Outdated
@@ -133,15 +134,23 @@ UniValue createmasternode(const JSONRPCRequest& request) | |||
|
|||
std::string ownerAddress = request.params[0].getValStr(); | |||
std::string operatorAddress = request.params.size() > 1 && !request.params[1].getValStr().empty() ? request.params[1].getValStr() : ownerAddress; | |||
std::string rewardAddress = !request.params[4].getValStr().empty() ? request.params[4].getValStr() : ownerAddress; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave empty if no reward is set, so just get an empty string here, dest will be 0 which is the toggle as to whether to use the reward address or not.
Closing stale PRs. |
This PR was created to fix this issue. It will allow the user to create a masternode while specifying a custom reward address.
RPCs