forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Introduce getprivatesendinfo and deprecate getpoolinfo #3140
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
26837be
Introduce getprivatesendinfo and deprecate getpoolinfo
UdjinM6 41e7a51
s/ToJson/GetJsonInfo/
UdjinM6 dacb706
s/queues/queue_size/
UdjinM6 33baab2
s/entries/entries_count/
UdjinM6 9b4582f
Add TODO to explain `denomination` string convertion
UdjinM6 a496177
Use `CURRENCY_UNIT`
UdjinM6 510fce6
Who needs safety belts after all
UdjinM6 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,44 +93,75 @@ UniValue privatesend(const JSONRPCRequest& request) | |
|
|
||
| UniValue getpoolinfo(const JSONRPCRequest& request) | ||
| { | ||
| if (request.fHelp || request.params.size() != 0) | ||
| throw std::runtime_error( | ||
| "getpoolinfo\n" | ||
| "Returns an object containing mixing pool related information.\n"); | ||
| throw std::runtime_error( | ||
| "getpoolinfo\n" | ||
| "DEPRECATED. Please use getprivatesendinfo instead.\n" | ||
| ); | ||
| } | ||
|
|
||
| #ifdef ENABLE_WALLET | ||
| CPrivateSendBaseManager* pprivateSendBaseManager = fMasternodeMode ? (CPrivateSendBaseManager*)&privateSendServer : (CPrivateSendBaseManager*)&privateSendClient; | ||
| UniValue getprivatesendinfo(const JSONRPCRequest& request) | ||
| { | ||
| if (request.fHelp || request.params.size() != 0) { | ||
| throw std::runtime_error( | ||
| "getprivatesendinfo\n" | ||
| "Returns an object containing an information about PrivateSend settings and state.\n" | ||
| "\nResult (for regular nodes):\n" | ||
| "{\n" | ||
| " \"enabled\": true|false, (bool) Whether mixing functionality is enabled\n" | ||
| " \"running\": true|false, (bool) Whether mixing is currently running\n" | ||
| " \"multisession\": true|false, (bool) Whether PrivateSend Multisession option is enabled\n" | ||
| " \"max_sessions\": xxx, (numeric) How many parallel mixing sessions can there be at once\n" | ||
| " \"max_rounds\": xxx, (numeric) How many rounds to mix\n" | ||
| " \"max_amount\": xxx, (numeric) How many " + CURRENCY_UNIT + " to keep anonimized\n" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @UdjinM6 Just found this one.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🙈 |
||
| " \"max_denoms\": xxx, (numeric) How many inputs of each denominated amount to create\n" | ||
| " \"queue_size\": xxx, (numeric) How many queues there are currently on the network\n" | ||
| " \"sessions\": (array of json objects)\n" | ||
| " [\n" | ||
| " {\n" | ||
| " \"protxhash\": \"...\", (string) The ProTxHash of the masternode\n" | ||
| " \"outpoint\": \"txid-index\", (string) The outpoint of the masternode\n" | ||
| " \"service\": \"host:port\", (string) The IP address and port of the masternode\n" | ||
| " \"denomination\": xxx, (numeric) The denomination of the mixing session in " + CURRENCY_UNIT + "\n" | ||
| " \"state\": \"...\", (string) Current state of the mixing session\n" | ||
| " \"entries_count\": xxx, (numeric) The number of entries in the mixing session\n" | ||
| " }\n" | ||
| " ,...\n" | ||
| " ],\n" | ||
| " \"keys_left\": xxx, (numeric) How many new keys are left since last automatic backup\n" | ||
| " \"warnings\": \"...\" (string) Warnings if any\n" | ||
| "}\n" | ||
| "\nResult (for masternodes):\n" | ||
| "{\n" | ||
| " \"queue_size\": xxx, (numeric) How many queues there are currently on the network\n" | ||
| " \"denomination\": xxx, (numeric) The denomination of the mixing session in " + CURRENCY_UNIT + "\n" | ||
| " \"state\": \"...\", (string) Current state of the mixing session\n" | ||
| " \"entries_count\": xxx, (numeric) The number of entries in the mixing session\n" | ||
| "}\n" | ||
| "\nExamples:\n" | ||
| + HelpExampleCli("getprivatesendinfo", "") | ||
| + HelpExampleRpc("getprivatesendinfo", "") | ||
| ); | ||
| } | ||
|
|
||
| UniValue obj(UniValue::VOBJ); | ||
| // TODO: | ||
| // obj.push_back(Pair("state", pprivateSendBase->GetStateString())); | ||
| obj.push_back(Pair("queue", pprivateSendBaseManager->GetQueueSize())); | ||
| // obj.push_back(Pair("entries", pprivateSendBase->GetEntriesCount())); | ||
| obj.push_back(Pair("status", privateSendClient.GetStatuses())); | ||
|
|
||
| std::vector<CDeterministicMNCPtr> vecDmns; | ||
| if (privateSendClient.GetMixingMasternodesInfo(vecDmns)) { | ||
| UniValue pools(UniValue::VARR); | ||
| for (const auto& dmn : vecDmns) { | ||
| UniValue pool(UniValue::VOBJ); | ||
| pool.push_back(Pair("outpoint", dmn->collateralOutpoint.ToStringShort())); | ||
| pool.push_back(Pair("addr", dmn->pdmnState->addr.ToString())); | ||
| pools.push_back(pool); | ||
| } | ||
| obj.push_back(Pair("pools", pools)); | ||
|
|
||
| if (fMasternodeMode) { | ||
| privateSendServer.GetJsonInfo(obj); | ||
| return obj; | ||
| } | ||
|
|
||
|
|
||
| #ifdef ENABLE_WALLET | ||
| privateSendClient.GetJsonInfo(obj); | ||
|
|
||
| CWallet* const pwallet = GetWalletForJSONRPCRequest(request); | ||
| if (pwallet) { | ||
| obj.push_back(Pair("keys_left", pwallet->nKeysLeftSinceAutoBackup)); | ||
| obj.push_back(Pair("warnings", pwallet->nKeysLeftSinceAutoBackup < PRIVATESEND_KEYS_THRESHOLD_WARNING | ||
| ? "WARNING: keypool is almost depleted!" : "")); | ||
| if (!pwallet) { | ||
| return obj; | ||
| } | ||
| #else // ENABLE_WALLET | ||
| UniValue obj(UniValue::VOBJ); | ||
| obj.push_back(Pair("state", privateSendServer.GetStateString())); | ||
| obj.push_back(Pair("queue", privateSendServer.GetQueueSize())); | ||
| obj.push_back(Pair("entries", privateSendServer.GetEntriesCount())); | ||
|
|
||
| obj.push_back(Pair("keys_left", pwallet->nKeysLeftSinceAutoBackup)); | ||
| obj.push_back(Pair("warnings", pwallet->nKeysLeftSinceAutoBackup < PRIVATESEND_KEYS_THRESHOLD_WARNING | ||
| ? "WARNING: keypool is almost depleted!" : "")); | ||
| #endif // ENABLE_WALLET | ||
|
|
||
| return obj; | ||
|
|
@@ -635,6 +666,7 @@ static const CRPCCommand commands[] = | |
| { "dash", "masternode", &masternode, true, {} }, | ||
| { "dash", "masternodelist", &masternodelist, true, {} }, | ||
| { "dash", "getpoolinfo", &getpoolinfo, true, {} }, | ||
| { "dash", "getprivatesendinfo", &getprivatesendinfo, true, {} }, | ||
| #ifdef ENABLE_WALLET | ||
| { "dash", "privatesend", &privatesend, false, {} }, | ||
| #endif // ENABLE_WALLET | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.