Skip to content
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

Closed
wants to merge 17 commits into from

Conversation

DocteurPing
Copy link
Contributor

This PR was created to fix this issue. It will allow the user to create a masternode while specifying a custom reward address.

RPCs

  • Createmasternode RPC was changed. A new parameter was added to the end of the list in order to specify the reward address. This parameter is optional. and if not specified it will be the address of the owner.

src/masternodes/mn_checks.h Outdated Show resolved Hide resolved
@prasannavl prasannavl changed the title Add the possibility to specify a reward address when creating a maste… Add support for custom reward address with createmasternode May 11, 2023
@prasannavl prasannavl changed the title Add support for custom reward address with createmasternode Add custom reward address to createmasternode RPC May 11, 2023
@@ -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;
Copy link
Member

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.

@@ -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) {
Copy link
Member

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.

@@ -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;
Copy link
Member

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.

@prasannavl prasannavl added the up-for-grab PRs are welcome // up for grab for anyone to work on label Aug 29, 2023
@prasannavl
Copy link
Member

Closing stale PRs.

@prasannavl prasannavl closed this Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
up-for-grab PRs are welcome // up for grab for anyone to work on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants