Skip to content

Commit f7b9d60

Browse files
Merge #7130: chore: sync formating of wallet/rpc code with Bitcoin Core
d46466f fmt: adjust formatting of rpc implementation for wallet to Bitcoin Core (Konstantin Akimov) Pull request description: ## Issue being fixed or feature implemented Doing backports for any RPC-related is struggle, because at some points formatting of files got different; due to missing changes from bitcoin#14726, bitcoin#25029, bitcoin#17809 and multiple other occasions. ## What was done? Manually sync formatting for wallet/rpc with Bitcoin Core v25.99 (commit bbbf89a) See also: #7129 These changes are split to 2 PR to reduce amount of conflicts and rebases in case of any backport are done due to huge diff size. Hint: use 'ignore whitespace' feature to review this PR. ## How Has This Been Tested? On top of this PR finally succeed to backport bitcoin#24118 for which I had lots of troubles to resolve conflicts. ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: UdjinM6: utACK d46466f Tree-SHA512: 32debb41f769658e09d2aa19c9da77c9c4f4be6341a70ec9a2095ac2e37e29dc22a93d665e069aa146f78dca97e37e69cadfd058d74a5dcc64b898af487306a0
2 parents 7d0d5a7 + d46466f commit f7b9d60

7 files changed

Lines changed: 1272 additions & 1271 deletions

File tree

src/wallet/rpc/addresses.cpp

Lines changed: 165 additions & 164 deletions
Large diffs are not rendered by default.

src/wallet/rpc/backup.cpp

Lines changed: 199 additions & 200 deletions
Large diffs are not rendered by default.

src/wallet/rpc/coins.cpp

Lines changed: 209 additions & 208 deletions
Large diffs are not rendered by default.

src/wallet/rpc/encrypt.cpp

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ namespace wallet {
1010
RPCHelpMan walletpassphrase()
1111
{
1212
return RPCHelpMan{"walletpassphrase",
13-
"\nStores the wallet decryption key in memory for 'timeout' seconds.\n"
14-
"This is needed prior to performing transactions related to private keys such as sending Dash\n"
15-
"\nNote:\n"
16-
"Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock\n"
17-
"time that overrides the old one.\n",
18-
{
19-
{"passphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet passphrase"},
20-
{"timeout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The time to keep the decryption key in seconds; capped at 100000000 (~3 years)."},
21-
{"mixingonly", RPCArg::Type::BOOL, RPCArg::Default{false}, "If is true sending functions are disabled."},
22-
},
23-
RPCResult{RPCResult::Type::NONE, "", ""},
24-
RPCExamples{
25-
"\nUnlock the wallet for 60 seconds\n"
26-
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\" 60") +
27-
"\nUnlock the wallet for 60 seconds but allow CoinJoin only\n"
28-
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\" 60 true") +
29-
"\nLock the wallet again (before 60 seconds)\n"
30-
+ HelpExampleCli("walletlock", "") +
31-
"\nAs a JSON-RPC call\n"
32-
+ HelpExampleRpc("walletpassphrase", "\"my pass phrase\", 60")
33-
},
13+
"\nStores the wallet decryption key in memory for 'timeout' seconds.\n"
14+
"This is needed prior to performing transactions related to private keys such as sending Dash\n"
15+
"\nNote:\n"
16+
"Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock\n"
17+
"time that overrides the old one.\n",
18+
{
19+
{"passphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet passphrase"},
20+
{"timeout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The time to keep the decryption key in seconds; capped at 100000000 (~3 years)."},
21+
{"mixingonly", RPCArg::Type::BOOL, RPCArg::Default{false}, "If is true sending functions are disabled."},
22+
},
23+
RPCResult{RPCResult::Type::NONE, "", ""},
24+
RPCExamples{
25+
"\nUnlock the wallet for 60 seconds\n"
26+
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\" 60") +
27+
"\nUnlock the wallet for 60 seconds but allow CoinJoin only\n"
28+
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\" 60 true") +
29+
"\nLock the wallet again (before 60 seconds)\n"
30+
+ HelpExampleCli("walletlock", "") +
31+
"\nAs a JSON-RPC call\n"
32+
+ HelpExampleRpc("walletpassphrase", "\"my pass phrase\", 60")
33+
},
3434
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
3535
{
3636
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
@@ -126,16 +126,16 @@ RPCHelpMan walletpassphrase()
126126
RPCHelpMan walletpassphrasechange()
127127
{
128128
return RPCHelpMan{"walletpassphrasechange",
129-
"\nChanges the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.\n",
130-
{
131-
{"oldpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The current passphrase"},
132-
{"newpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The new passphrase"},
133-
},
134-
RPCResult{RPCResult::Type::NONE, "", ""},
135-
RPCExamples{
136-
HelpExampleCli("walletpassphrasechange", "\"old one\" \"new one\"")
137-
+ HelpExampleRpc("walletpassphrasechange", "\"old one\", \"new one\"")
138-
},
129+
"\nChanges the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.\n",
130+
{
131+
{"oldpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The current passphrase"},
132+
{"newpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The new passphrase"},
133+
},
134+
RPCResult{RPCResult::Type::NONE, "", ""},
135+
RPCExamples{
136+
HelpExampleCli("walletpassphrasechange", "\"old one\" \"new one\"")
137+
+ HelpExampleRpc("walletpassphrasechange", "\"old one\", \"new one\"")
138+
},
139139
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
140140
{
141141
std::shared_ptr<CWallet> const pwallet = GetWalletForJSONRPCRequest(request);
@@ -179,21 +179,21 @@ RPCHelpMan walletpassphrasechange()
179179
RPCHelpMan walletlock()
180180
{
181181
return RPCHelpMan{"walletlock",
182-
"\nRemoves the wallet encryption key from memory, locking the wallet.\n"
183-
"After calling this method, you will need to call walletpassphrase again\n"
184-
"before being able to call any methods which require the wallet to be unlocked.\n",
185-
{},
186-
RPCResult{RPCResult::Type::NONE, "", ""},
187-
RPCExamples{
188-
"\nSet the passphrase for 2 minutes to perform a transaction\n"
189-
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\" 120") +
190-
"\nPerform a send (requires passphrase set)\n"
191-
+ HelpExampleCli("sendtoaddress", "\"" + EXAMPLE_ADDRESS[0] + "\" 1.0") +
192-
"\nClear the passphrase since we are done before 2 minutes is up\n"
193-
+ HelpExampleCli("walletlock", "") +
194-
"\nAs a JSON-RPC call\n"
195-
+ HelpExampleRpc("walletlock", "")
196-
},
182+
"\nRemoves the wallet encryption key from memory, locking the wallet.\n"
183+
"After calling this method, you will need to call walletpassphrase again\n"
184+
"before being able to call any methods which require the wallet to be unlocked.\n",
185+
{},
186+
RPCResult{RPCResult::Type::NONE, "", ""},
187+
RPCExamples{
188+
"\nSet the passphrase for 2 minutes to perform a transaction\n"
189+
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\" 120") +
190+
"\nPerform a send (requires passphrase set)\n"
191+
+ HelpExampleCli("sendtoaddress", "\"" + EXAMPLE_ADDRESS[0] + "\" 1.0") +
192+
"\nClear the passphrase since we are done before 2 minutes is up\n"
193+
+ HelpExampleCli("walletlock", "") +
194+
"\nAs a JSON-RPC call\n"
195+
+ HelpExampleRpc("walletlock", "")
196+
},
197197
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
198198
{
199199
std::shared_ptr<CWallet> const pwallet = GetWalletForJSONRPCRequest(request);
@@ -216,27 +216,27 @@ RPCHelpMan walletlock()
216216
RPCHelpMan encryptwallet()
217217
{
218218
return RPCHelpMan{"encryptwallet",
219-
"\nEncrypts the wallet with 'passphrase'. This is for first time encryption.\n"
220-
"After this, any calls that interact with private keys such as sending or signing \n"
221-
"will require the passphrase to be set prior the making these calls.\n"
222-
"Use the walletpassphrase call for this, and then walletlock call.\n"
223-
"If the wallet is already encrypted, use the walletpassphrasechange call.\n",
224-
{
225-
{"passphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long."},
226-
},
227-
RPCResult{RPCResult::Type::STR, "", "A string with further instructions"},
228-
RPCExamples{
229-
"\nEncrypt your wallet\n"
230-
+ HelpExampleCli("encryptwallet", "\"my pass phrase\"") +
231-
"\nNow set the passphrase to use the wallet, such as for signing or sending Dash\n"
232-
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\"") +
233-
"\nNow we can do something like sign\n"
234-
+ HelpExampleCli("signmessage", "\"address\" \"test message\"") +
235-
"\nNow lock the wallet again by removing the passphrase\n"
236-
+ HelpExampleCli("walletlock", "") +
237-
"\nAs a JSON-RPC call\n"
238-
+ HelpExampleRpc("encryptwallet", "\"my pass phrase\"")
239-
},
219+
"\nEncrypts the wallet with 'passphrase'. This is for first time encryption.\n"
220+
"After this, any calls that interact with private keys such as sending or signing \n"
221+
"will require the passphrase to be set prior the making these calls.\n"
222+
"Use the walletpassphrase call for this, and then walletlock call.\n"
223+
"If the wallet is already encrypted, use the walletpassphrasechange call.\n",
224+
{
225+
{"passphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long."},
226+
},
227+
RPCResult{RPCResult::Type::STR, "", "A string with further instructions"},
228+
RPCExamples{
229+
"\nEncrypt your wallet\n"
230+
+ HelpExampleCli("encryptwallet", "\"my pass phrase\"") +
231+
"\nNow set the passphrase to use the wallet, such as for signing or sending Dash\n"
232+
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\"") +
233+
"\nNow we can do something like sign\n"
234+
+ HelpExampleCli("signmessage", "\"address\" \"test message\"") +
235+
"\nNow lock the wallet again by removing the passphrase\n"
236+
+ HelpExampleCli("walletlock", "") +
237+
"\nAs a JSON-RPC call\n"
238+
+ HelpExampleRpc("encryptwallet", "\"my pass phrase\"")
239+
},
240240
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
241241
{
242242
std::shared_ptr<CWallet> const pwallet = GetWalletForJSONRPCRequest(request);

0 commit comments

Comments
 (0)