aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/misc.cpp
AgeCommit message (Collapse)Author
2017-09-28Implement BIP173 addresses and testsPieter Wuille
2017-09-08Merge #10793: Changing &var[0] to var.data()Wladimir J. van der Laan
592404f03 Changing &vec[0] to vec.data(), what 9804 missed (MeshCollider) Pull request description: This just continues the work of https://github.com/bitcoin/bitcoin/pull/9804 Modifies a lot of `&vector[]`'s to `vector.data()`'s across all the files including tests, just the stuff that 9804 missed Tree-SHA512: dd1a9dffb999dea4fba78dcc91fe02f90250db86f5c74948e1ff3e8b4036b2154b600555eaa04dece5368920aae3513bc36425dc96e4319ca1041b0928a6b656
2017-09-08Changing &vec[0] to vec.data(), what 9804 missedMeshCollider
2017-09-06(finally) remove getinfo in favor of more module-specific infosMatt Corallo
2017-09-06Introduce wrappers around CBitcoinAddressPieter Wuille
This patch removes the need for the intermediary Base58 type CBitcoinAddress, by providing {Encode,Decode,IsValid}Destination function that directly operate on the conversion between strings and CTxDestination.
2017-08-29rpc: Push down safe mode checksAndrew Chow
This contains most of the changes of 10563 "remove safe mode", but doesn't remove the safe mode yet, but put an `ObserveSafeMode()` check in individual calls with okSafeMode=false. This cleans up the ugly "okSafeMode" flag from the dispatch tables, which is not a concern for the RPC server. Extra-author: Wladimir J. van der Laan <laanwj@gmail.com>
2017-08-22Merge #11050: Avoid treating null RPC arguments different from missing argumentsWladimir J. van der Laan
745d2e3 Clean up getbalance RPC parameter handling (Russell Yanofsky) fd5d71e Update developer notes after params.size() cleanup (Russell Yanofsky) e067673 Avoid treating null RPC arguments different from missing arguments (Russell Yanofsky) e666efc Get rid of redundant RPC params.size() checks (Russell Yanofsky) Pull request description: This is a followup to #10783. - The first commit doesn't change behavior at all, just simplifies code. - The second commit just changes RPC methods to treat null arguments the same as missing arguments instead of throwing type errors. - The third commit updates developer notes after the cleanup. - The forth commit does some additional code cleanup in `getbalance`. Followup changes that should happen in future PRs: - [ ] Replace uses of `.isTrue()` with calls to `.get_bool()` so numbers, objects, and strings cause type errors instead of being interpreted as false. https://github.com/bitcoin/bitcoin/pull/11050#discussion_r133850525 - [ ] Add braces around if statements. https://github.com/bitcoin/bitcoin/pull/11050#discussion_r133851133 - [ ] Maybe improve UniValue type error exceptions and eliminate RPCTypeCheck and RPCTypeCheckArgument functions. https://github.com/bitcoin/bitcoin/pull/11050#discussion_r133829303 Tree-SHA512: e72f696011d20acc0778e996659e41f9426bffce387b29ff63bf59ad1163d5146761e4445b2b9b9e069a80596a57c7f4402b75a15d5d20f69f775ae558cf67e9
2017-08-16Declare single-argument (non-converting) constructors "explicit"practicalswift
In order to avoid unintended implicit conversions.
2017-08-14Get rid of redundant RPC params.size() checksRussell Yanofsky
No change in behavior.
2017-08-14Merge #10483: scripted-diff: Use the C++11 keyword nullptr to denote the ↵Wladimir J. van der Laan
pointer literal instead of the macro NULL 90d4d89 scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL (practicalswift) Pull request description: Since C++11 the macro `NULL` may be: * an integer literal with value zero, or * a prvalue of type `std::nullptr_t` By using the C++11 keyword `nullptr` we are guaranteed a prvalue of type `std::nullptr_t`. For a more thorough discussion, see "A name for the null pointer: nullptr" (Sutter & Stroustrup), http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf With this patch applied there are no `NULL` macro usages left in the repo: ``` $ git grep NULL -- "*.cpp" "*.h" | egrep -v '(/univalue/|/secp256k1/|/leveldb/|_NULL|NULLDUMMY|torcontrol.*NULL|NULL cert)' | wc -l 0 ``` The road towards `nullptr` (C++11) is split into two PRs: * `NULL` → `nullptr` is handled in PR #10483 (scripted, this PR) * `0` → `nullptr` is handled in PR #10645 (manual) Tree-SHA512: 3c395d66f2ad724a8e6fed74b93634de8bfc0c0eafac94e64e5194c939499fefd6e68f047de3083ad0b4eff37df9a8a3a76349aa17d55eabbd8e0412f140a297
2017-08-07rpc: Move ValueFromAmount to core_writeWladimir J. van der Laan
This is necessary because core_write has to write amounts in TxToUniv, and mistakingly uses FormatMoney for that (which is only for debugging). We don't move AmountFromValue at the same time, as this is more challenging due to the RPCError depencency there.
2017-08-07scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal ↵practicalswift
instead of the macro NULL -BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
2017-07-19Merge #10857: [RPC] Add a deprecation warning to getinfo's outputWladimir J. van der Laan
1c9b818 getinfo deprecation warning (Andrew Chow) Pull request description: This is an alternative to #10841 This PR implements @gmaxwell's suggestion of a `nag` field for getinfo which warns about the deprecation. Instead of calling it `nag`, I have named it `deprecation-warning`. The output of `getinfo` will look like this: ``` { "version": 149900, "protocolversion": 70015, "walletversion": 139900, "balance": 0.00000000, "blocks": 476281, "timeoffset": 0, "connections": 2, "proxy": "", "difficulty": 804525194568.1318, "testnet": false, "keypoololdest": 1496858803, "keypoolsize": 197, "unlocked_until": 0, "paytxfee": 0.00000000, "relayfee": 0.00001000, "errors": "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications", "deprecation-warning": "WARNING: getinfo is deprecated and will be fully removed in 0.16. Projects should transition to using getblockchaininfo, getnetworkinfo, and getwalletinfo before upgrading to 0.16" } ``` I think this should be tagged for 0.15 Tree-SHA512: ea1bac96a67f797519e8748ddd661cf0a1127cbc38f145b98f10cf9b54dcf0519b353062ce9888e1f51875497299c75ff5147566944451bc3fc117620e773489
2017-07-18getinfo deprecation warningAndrew Chow
2017-07-18Avoid redundant redeclaration of GetWarnings(const string&)practicalswift
std::string GetWarnings(const std::string& strFor) is declared in warnings.h and defined in warnings.cpp.
2017-06-30document script-based return fields for validateaddressGregory Sanders
2017-06-13Merge #10502: scripted-diff: Remove BOOST_FOREACH, Q_FOREACH and PAIRTYPEPieter Wuille
1238f13cf scripted-diff: Remove PAIRTYPE (Jorge Timón) 18dc3c396 scripted-diff: Remove Q_FOREACH (Jorge Timón) 7c00c2672 scripted-diff: Fully remove BOOST_FOREACH (Jorge Timón) a5410ac5e Small preparations for Q_FOREACH, PAIRTYPE and #include <boost/foreach.hpp> removal (Jorge Timón) Tree-SHA512: d3ab4a173366402e7dcef31608977b757d4aa07abbbad2ee1bcbcfa311e994a4552f24e5a55272cb22c2dcf89a4b0495e02e9d9aceae4b08c0bab668f20e324c
2017-06-13Merge #10553: Simplify "bool x = y ? true : false". Remove unused function ↵Wladimir J. van der Laan
and trailing semicolon. 67ca816 Simplify "bool x = y ? true : false" to "bool x = y" (practicalswift) 9f841a6 [tests] Remove accidental trailing semicolon (practicalswift) 30c2d9d [tests] Remove unused function InsecureRandBytes(size_t len) (practicalswift) Tree-SHA512: ae62c255c88133cad12084b6011c105bb96b729c8103330350683d9c20020c5d7617693795df4dff6cc305f2405cb2e4e2ece182d6e6d7c3c8db82aa2f882c41
2017-06-11Simplify "bool x = y ? true : false" to "bool x = y"practicalswift
2017-06-06Use list initialization (C++11) for maps/vectors instead of ↵practicalswift
boost::assign::map_list_of/list_of
2017-06-05scripted-diff: Fully remove BOOST_FOREACHJorge Timón
-BEGIN VERIFY SCRIPT- sed -i 's/BOOST_FOREACH *(\(.*\),/for (\1 :/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ; -END VERIFY SCRIPT-
2017-04-20Merge #10181: Include cleanupWladimir J. van der Laan
1c897fc Missing includes (Jorge Timón) a1fd450 Trivial: Remove unneeded includes from .h: (Jorge Timón) Tree-SHA512: ada3e62cc2435e58172a88b380be371b717a05725956c15e5493b6e19fe2903e5e6e43fd22dc24699333a0e8a0c7b42eb1ae61b41cb4ba82495be18e2d4ef3c6
2017-04-13Missing includesJorge Timón
2017-04-10allow libevent logging to be updated during runtimeJohn Newbery
2017-04-10[rpc] Add logging RPCJohn Newbery
Adds an RPC to get and set currently active logging categories.
2017-03-27refactor: Move GetDifficulty out of `rpc/server.h`Wladimir J. van der Laan
It has no business in `rpcserver.h`. Define it in the interface header of the implementation unit `rpcblockchain` where it is defined. Also modernize the signature to: double GetDifficulty(const CBlockIndex* blockindex = nullptr); (remove `extern`, replace `NULL` with `nullptr`)
2017-03-20Add mallocinfo mode to `getmemoryinfo` RPCWladimir J. van der Laan
This adds a mode argument to `getmemoryinfo`. By default the output will remain the same. However if a mode argument of `mallocinfo` is provided the result of glibc `malloc_info` (if available) will be returned as a string, as-is. This is useful for tracking heap usage over time or troubleshooting memory fragmentation issues.
2017-03-08Refactor: Remove using namespace <xxx> from rpc/Karl-Johan Alm
2017-03-07Merge #9602: Remove coin age priority and free transactions - implementationWladimir J. van der Laan
b421e6d Update example bitcoin.conf (Alex Morcos) 7d4e950 Allow setting minrelaytxfee to 0 (Alex Morcos) 359e8a0 [cleanup] Remove coin age priority completely. (Alex Morcos) f9b9371 [rpc] Remove priorityDelta from prioritisetransaction (Alex Morcos) 49be7e1 [rpc] Remove priority information from mempool RPC calls (Alex Morcos) 0315888 [test] Remove priority from tests (Alex Morcos) f838005 No longer allow "free" transactions (Alex Morcos) ad727f4 [rpc] sendrawtransaction no longer bypasses minRelayTxFee (Alex Morcos) fe282ac [cleanup] Remove estimatePriority and estimateSmartPriority (Alex Morcos) 400b151 [debug] Change -printpriority option (Alex Morcos) 272b25a [mining] Remove -blockprioritysize. (Alex Morcos) 12839cd [rpc] Remove estimatepriority and estimatesmartpriority. (Alex Morcos) ddf58c7 wallet: Remove sendfree (MarcoFalke) Tree-SHA512: a9a4499405923ce794ef18f9e334dbbd59dfc73a3dc2df6f85cc9c62af6f353ec2eed9c2d5e58e904f918d0d7ab738f403dd4939d9bc2276136864fe63710782
2017-03-03No longer allow "free" transactionsAlex Morcos
Remove -limitfreerelay and always enforce minRelayTxFee in the mempool (except from disconnected blocks) Remove -relaypriority, the option was only used for the ability to allow free transactions to be relayed regardless of their priority. Both notions no longer apply.
2017-03-03Merge #8775: RPC refactoring: Access wallet using new GetWalletForJSONRPCRequestWladimir J. van der Laan
d678771 Wallet: Sanitise -wallet parameter (Luke Dashjr) 9756be3 Wallet/RPC: Use filename rather than CWallet pointer, for lockwallet RPCRunLater job name (Luke Dashjr) 86be48a More tightly couple EnsureWalletIsAvailable with GetWalletForJSONRPCRequest where appropriate (Luke Dashjr) a435632 Move wallet RPC declarations to rpcwallet.h (Luke Dashjr) ad15734 RPC: Pass on JSONRPCRequest metadata (URI/user/etc) for "help" method (Luke Dashjr) bf8a04a Reformat touched lines with C++11 (Luke Dashjr) 2e518e3 Move nWalletUnlockTime to CWallet::nRelockTime, and name timed task unique per CWallet (Luke Dashjr) d77ad6d RPC: Do all wallet access through new GetWalletForJSONRPCRequest (Luke Dashjr) eca550f RPC/Wallet: Pass CWallet as pointer to helper functions (Luke Dashjr) Tree-SHA512: bfd592da841693390e16f83b451503eb5cedb71208089aa32b3fc45e973555584a3ed7696dd239f6409324464d565dacf0f3d0e36e8e13ae6a7843848465f960
2017-02-27Move wallet RPC declarations to rpcwallet.hLuke Dashjr
2017-02-27Reformat touched lines with C++11Luke Dashjr
2017-02-27Move nWalletUnlockTime to CWallet::nRelockTime, and name timed task unique ↵Luke Dashjr
per CWallet
2017-02-27RPC: Do all wallet access through new GetWalletForJSONRPCRequestLuke Dashjr
2017-02-27RPC/Wallet: Pass CWallet as pointer to helper functionsLuke Dashjr
2017-02-26Change bitcoin address in RPC helpaddress to an invalid address, so people ↵Marijn Stollenga
don't accidentally send coins there (like I did).
2017-02-18Merge #9696: [trivial] Fix recently introduced typos in commentsMarcoFalke
0c9b9b7 [trivial] Fix recently introduced typos in comments (practicalswift)
2017-02-14[trivial] Fix recently introduced typos in commentspracticalswift
2017-02-10Use importmulti timestamp when importing watch only keysRussell Yanofsky
When importing a watch-only address over importmulti with a specific timestamp, the wallet's nTimeFirstKey is currently set to 1. After this change, the provided timestamp will be used and stored as metadata associated with watch-only key. This can improve wallet performance because it can avoid the need to scan the entire blockchain for watch only addresses when timestamps are provided. Also adds timestamp to validateaddress return value (needed for tests). Fixes #9034.
2017-02-10Add test to check new importmulti "now" valueRussell Yanofsky
Easiest way to test this was to expose the timestamp via the validateaddress RPC (which was already looking up and returning key metadata).
2017-01-25net: Consistently use GetTimeMicros() for inactivity checksSuhas Daftuar
The use of mocktime in test logic means that comparisons between GetTime() and GetTimeMicros()/1000000 are unreliable since the former can use mocktime values while the latter always gets the system clock; this changes the networking code's inactivity checks to consistently use the system clock for inactivity comparisons. Also remove some hacks from setmocktime() that are no longer needed, now that we're using the system clock for nLastSend and nLastRecv.
2017-01-10Update RPC argument namesJohn Newbery
2017-01-10rpc: Named argument support for bitcoin-cliWladimir J. van der Laan
Usage e.g.: $ src/bitcoin-cli -testnet -named echo arg0="dfdf" [ "dfdf" ] Argument conversion also works, for arguments thus flagged in the table in `src/rpc/client.cpp`. $ src/bitcoin-cli -testnet -named echojson arg0="[1,2,3]" [ [ 1, 2, 3 ] ] Unknown parameter (detected server-side): $ src/bitcoin-cli -testnet -named getinfo arg0="dfdf" error code: -8 error message: Unknown named parameter arg0
2017-01-05rpc: Argument name consistencyWladimir J. van der Laan
The meaning is clear from the context, and we're inconsistent here. Also save typing when using named arguments. - `bitcoinaddress` -> `address` - `bitcoinprivkey` -> `privkey` - `bitcoinpubkey` -> `pubkey`
2017-01-05rpc: Named arguments for misc callsWladimir J. van der Laan
2017-01-05rpc: Add 'echo' call for testingWladimir J. van der Laan
This hidden call simply returns what is passed in.
2016-12-31Increment MIT Licence copyright header year on files modified in 2016isle2983
Edited via: $ contrib/devtools/copyright_header.py update .
2016-12-02Rename the remaining main.{h,cpp} to validation.{h,cpp}Matt Corallo
2016-11-02Merge #8753: Locked memory managerWladimir J. van der Laan
444c673 bench: Add benchmark for lockedpool allocation/deallocation (Wladimir J. van der Laan) 6567999 rpc: Add `getmemoryinfo` call (Wladimir J. van der Laan) 4536148 support: Add LockedPool (Wladimir J. van der Laan) f4d1fc2 wallet: Get rid of LockObject and UnlockObject calls in key.h (Wladimir J. van der Laan) 999e4c9 wallet: Change CCrypter to use vectors with secure allocator (Wladimir J. van der Laan)