aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-cli.cpp
AgeCommit message (Collapse)Author
2022-08-19Merge bitcoin/bitcoin#25707: refactor: Make const references to avoid ↵MacroFake
unnecessarily copying objects and enable two clang-tidy checks ae7ae36d311a869b3bda41d29dc0e47fade77d28 tidy: Enable two clang-tidy checks (Aurèle Oulès) 081b0e53e3adca7ea57d23e5fcd9db4b86415a72 refactor: Make const refs vars where applicable (Aurèle Oulès) Pull request description: I added const references to some variables to avoid unnecessarily copying objects. Also added two clang-tidy checks : [performance-for-range-copy](https://releases.llvm.org/11.1.0/tools/clang/tools/extra/docs/clang-tidy/checks/performance-for-range-copy.html) and [performance-unnecessary-copy-initialization](https://releases.llvm.org/12.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/performance-unnecessary-copy-initialization.html). ACKs for top commit: vasild: ACK ae7ae36d311a869b3bda41d29dc0e47fade77d28 MarcoFalke: review ACK ae7ae36d311a869b3bda41d29dc0e47fade77d28 Tree-SHA512: f6ac6b0cd0eee1e0c34d2f186484bc0f7ec6071451cccb33fa88a67d93d92b304e2fac378b88f087e94657745bca4e966dbc443759587400eb01b1f3061fde8c
2022-08-04Merge bitcoin/bitcoin#24675: util: Use ArgsManager::GetPathArg more widelyfanquake
b01f336708019f8c8274ea701d3446e4123e7af2 util, refactor: Drop explicit conversion to fs::path (Hennadii Stepanov) 138c668e2b4d64279ddefbe07c1d9b7c3d3c537c util, refactor: Use GetPathArg to read "-rpccookiefile" value (Hennadii Stepanov) 1276090705060fcc97072481c2383bbaaa556194 util, refactor: Use GetPathArg to read "-conf" value (Hennadii Stepanov) Pull request description: This PR is a continuation of bitcoin/bitcoin#24265 and bitcoin/bitcoin#24306. Now the following command-line arguments / configure options been read with the `GetPathArg` method: - `-conf`, also `includeconf` values been normalized - `-rpccookiefile` ACKs for top commit: jarolrod: Code Review ACK b01f336708019f8c8274ea701d3446e4123e7af2 ryanofsky: Code review ACK b01f336708019f8c8274ea701d3446e4123e7af. Changes since last review: just dropping first commit (NormalizedPathFromString) as suggested Tree-SHA512: 2d26d50b73542acdbcc63a32068977b2a49a017d31ca337471a0446f964eb0a6e3e4e3bb1ebe6771566a260f2cae3bc2ebe93b4b523183cea0d51768daab85c9
2022-07-27refactor: Make const refs vars where applicableAurèle Oulès
This avoids initializing variables with the copy-constructor of a non-trivially copyable type.
2022-07-20refactor: move compat.h into compat/fanquake
2022-06-11compat: Consolidate mingw-w64 ASLR workaround for upstream libsecp changesfanquake
Achieve this by adding a MAIN_FUNCTION macro, consolidating the docs, and introducing the macro across our distributed binaries. Also update the docs to explain that anyone using binutils < 2.36 is effected by this issue. Release builds are not, because they use binutils 2.37. Currently LTS Linux distros, like Ubuntu Focal, ship with 2.34. https://packages.ubuntu.com/focal/binutils
2022-05-20Rename NetinfoRequestHandler::is_block_relay data member to is_tx_relayJon Atack
and inverse its logic. The naming is out of date and incorrect, as lack of request of tx relay does not imply block relay, and a preference for tx relay doesn't imply that block relay isn't happening.
2022-05-20Fix frequent -netinfo JSON errors from null getpeerinfo#relaytxesJon Atack
"error: JSON value is not a boolean as expected" due to fRelayTxes/m_relay_txs being moved in PR 21160 from CNodeStats to CNodeStateStats, which made getpeerinfo#relaytxes an optional field that can return UniValue IsNull().
2022-05-20Merge bitcoin/bitcoin#25101: Add mockable clock typefanquake
fa305fd92c0a5a91831be3ccec0a5ef962a5fbcb Add mockable clock type and TicksSinceEpoch helper (MarcoFalke) Pull request description: This will be used primarily by the addr time refactor (https://github.com/bitcoin/bitcoin/pull/24697) to make addr relay time type safe. However, it can also be used in other places, and can be reviewed independently, so I split it up. ACKs for top commit: jonatack: ACK fa305fd92c0a5a91831be3ccec0a5ef962a5fbcb per `git range-diff 7b3343f fa20781 fa305fd` ajtowns: ACK fa305fd92c0a5a91831be3ccec0a5ef962a5fbcb Tree-SHA512: da00200126833c1f55b1b1e68f596eab5c9254e82b188ad17779c08ffd685e198a7c5270791b4b69a858dc6ba4e051fe0c8b445d203d356d0c884f6365ee1cfe
2022-05-19Merge bitcoin/bitcoin#25153: scripted-diff: Use getInt<T> over get_int/get_int64fanquake
fa9af218780b7960d756db80c57222e5bf2137b1 scripted-diff: Use getInt<T> over get_int/get_int64 (MacroFake) Pull request description: Seems better to see the return type directly and be able to modify it easier, as the return type is used for exceptions (in-range checking and parsing feedback). ACKs for top commit: fanquake: ACK fa9af218780b7960d756db80c57222e5bf2137b1 Tree-SHA512: 284aa2527d0f663ca01550115025c9c64c787531d595f866c718f6ad09b9b0cac1e683a7d77f8009b75de990fd37166b44063ffa83fba8a04e9a31600b4c2725
2022-05-18Merge bitcoin/bitcoin#25108: tidy: add modernize-use-default-member-initMacroFake
ac6fbf2c83578129a0397d0d0dc9b1c6bdb30701 tidy: use modernize-use-default-member-init (fanquake) 7aa40f55636be565441a9e0af8de0a346bfa4da2 refactor: use C++11 default initializers (fanquake) Pull request description: Refactor and then enable [`modernize-use-default-member-init`](https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-default-member-init.html) in our `clang-tidy` job. Top commit has no ACKs. Tree-SHA512: 536b406f20639f8c588fe9e96175ec60c7bb825506b2670b562370b2f572801c24203c483443be3c199e1b958c0765d4532e57c57a4e78689162a1dd422d844f
2022-05-18scripted-diff: Use getInt<T> over get_int/get_int64MacroFake
-BEGIN VERIFY SCRIPT- sed -i 's|\<get_int64\>|getInt<int64_t>|g' $(git grep -l get_int ':(exclude)src/univalue') sed -i 's|\<get_int\>|getInt<int>|g' $(git grep -l get_int ':(exclude)src/univalue') -END VERIFY SCRIPT-
2022-05-18Add mockable clock type and TicksSinceEpoch helperMarcoFalke
2022-05-17refactor: use C++11 default initializersfanquake
2022-05-17Use steady_clock in ConnectAndCallRPC and inline time call in loop conditionalJon Atack
to avoid unnecessary invocations and an unneeded local variable allocation.
2022-05-17Fix -rpcwait with -netinfo printing negative time durationsJon Atack
Fixes negative time duration values in the "send", "recv", and "age" columns (potentially the "txn" and "blk" columns also) for the first run of -rpcwait -netinfo after bitcoind startup. To reproduce, start bitcoind on mainnet and run `bitcoin-cli -rpcwait -netinfo <n>` where n is 1 or larger. The negative times will be larger/more apparent with a slower CPU speed or e.g. higher checkblocks/checklevel config option settings.
2022-05-11Remove unused GetTimeSecondsMacroFake
2022-04-21util, refactor: Use GetPathArg to read "-conf" valueHennadii Stepanov
Also "includeconf" values been normalized.
2022-04-13Merge bitcoin/bitcoin#24632: add `(none)` in -getinfo `Warnings:` if no ↵laanwj
warning returned 0cea7b10f1180e9993c14473e1a3b6525ef6ba01 print `(none)` if no warnings in -getinfo (/dev/fd0) Pull request description: Adds `(none)` in warnings when no warnings returned by -getinfo Reviewers can test this by making the following change in `/src/warnings.cpp`: ```diff bilingual_str GetWarnings(bool verbose) { bilingual_str warnings_concise; std::vector<bilingual_str> warnings_verbose; LOCK(g_warnings_mutex); // Pre-release build warning if (!CLIENT_VERSION_IS_RELEASE) { - warnings_concise = _("This is a pre-release test build - use at your own risk - do not use for mining or merchant applications");; + warnings_concise = _("");; ``` Before this pull request: ``` $ bitcoin-cli -getinfo Chain: regtest Blocks: 0 Headers: 0 Verification progress: 100.0000% Difficulty: 4.656542373906925e-10 Network: in 0, out 0, total 0 Version: 239900 Time offset (s): 0 Proxies: n/a Min tx relay fee rate (BTC/kvB): 0.00001000 Warnings: ``` After this pull request: ```diff $ bitcoin-cli -getinfo Chain: regtest Blocks: 0 Headers: 0 Verification progress: 100.0000% Difficulty: 4.656542373906925e-10 Network: in 0, out 0, total 0 Version: 239900 Time offset (s): 0 Proxies: n/a Min tx relay fee rate (BTC/kvB): 0.00001000 Warnings: (none) ``` ACKs for top commit: jonatack: ACK 0cea7b10f1180e9993c14473e1a3b6525ef6ba01 laanwj: Tested ACK 0cea7b10f1180e9993c14473e1a3b6525ef6ba01 Tree-SHA512: a12499d11ff84bc954db354f968eb1f5ee4999d8b80581fe0bdf604732b2e2f608cb5c35c4ca8cb5a430f3991954a6207f0758302618662e6b9505044cf2dc95
2022-04-08print `(none)` if no warnings in -getinfo/dev/fd0
2022-03-30refactor: account for requiring libevent 2.1.8+fanquake
2022-02-22Output license info when binaries are passed -versionfanquake
Consolidate to outputting the licensing info when we pass -version to a binary, i.e bitcoind -version: ```bash itcoin Core version v22.99.0-fc1f355913f6-dirty Copyright (C) 2009-2022 The Bitcoin Core developers Please contribute if you find Bitcoin Core useful. Visit <https://bitcoincore.org/> for further information about the software. The source code is available from <https://github.com/bitcoin/bitcoin>. This is experimental software. Distributed under the MIT software license, see the accompanying file COPYING or <https://opensource.org/licenses/MIT> ```
2022-02-21cli: describe quality/recency filtering in -addrinfoJon Atack
Co-authored-by: Martin Zumsande <mzumsande@gmail.com>
2022-02-21doc: Rework generate* docMarcoFalke
Can be reviewed with --word-diff-regex=. --ignore-all-space
2022-02-16Improve -netinfo help based on feedback from users and devsJon Atack
- clarify that the peer counts table is of reachable networks - a few other clarifications
2021-12-30scripted-diff: Bump copyright headersHennadii Stepanov
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT- Commits of previous years: * 2020: fa0074e2d82928016a43ca408717154a1c70a4db * 2019: aaaaad6ac95b402fe18d019d67897ced6b316ee0
2021-11-11cli: hoist networks class data members to a constantJon Atack
2021-11-11cli: add cjdns network to -addrinfo and -netinfoJon Atack
2021-10-25scripted-diff: disable unimplemented ArgsManager BOOL/INT/STRING flagsRussell Yanofsky
This commit does not change behavior in any way. See previous commit for complete rationale, but these flags are being disabled because they aren't implemented and will otherwise break backwards compatibility when they are implemented. -BEGIN VERIFY SCRIPT- sed -i 's:\(ALLOW_.*\) \(//!< unimplemented\):// \1\2:' src/util/system.h sed -i '/DISALLOW_NEGATION.*scripted-diff/d' src/util/system.cpp git grep -l 'ArgsManager::ALLOW_\(INT\|STRING\)' | xargs sed -i 's/ArgsManager::ALLOW_\(INT\|STRING\)/ArgsManager::ALLOW_ANY | ArgsManager::DISALLOW_NEGATION/g' git grep -l 'ALLOW_BOOL' -- ':!src/util/system.h' | xargs sed -i 's/ALLOW_BOOL/ALLOW_ANY/g' -END VERIFY SCRIPT-
2021-10-20netinfo: print peer counts for all reachable networksJon Atack
instead of only for networks we have peer connections to. Users reported the previous behavior caused confusion, as no column was printed when a network was reachable but no peers were connected. Users expected a column to be printed with 0 peers. This commit aligns behavior with that expectation.
2021-10-05refactor: Block unsafe fs::path std::string conversion callsRussell Yanofsky
There is no change in behavior. This just helps prepare for the transition from boost::filesystem to std::filesystem by avoiding calls to methods which will be unsafe after the transaction to std::filesystem to due lack of a boost::filesystem::path::imbue equivalent and inability to set a predictable locale. Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Co-authored-by: Kiminuo <kiminuo@protonmail.com> Co-authored-by: MarcoFalke <falke.marco@gmail.com>
2021-09-27scripted-diff: Rename overloaded int GetArg to GetIntArgRussell Yanofsky
Improve readability of code, simplify future scripted diff cleanup PRs, and be more consistent with naming for GetBoolArg. This will also be useful for replacing runtime settings type checking with compile time checking. -BEGIN VERIFY SCRIPT- git grep -l GetArg | xargs sed -i 's/GetArg(\([^)]*\( [0-9]\+\|-1\|port\|BaseParams().RPCPort()\|Params().GetDefaultPort()\|_TIMEOUT\|Height\|_WORKQUEUE\|_THREADS\|_CONNECTIONS\|LIMIT\|SigOp\|Bytes\|_VERSION\|_AGE\|_CHECKS\|Checks() ? 1 : 0\|_BANTIME\|Cache\|BLOCKS\|LEVEL\|Weight\|Version\|BUFFER\|TARGET\|WEIGHT\|TXN\|TRANSACTIONS\|ADJUSTMENT\|i64\|Size\|nDefault\|_EXPIRY\|HEIGHT\|SIZE\|SNDHWM\|_TIME_MS\)\))/GetIntArg(\1)/g' -END VERIFY SCRIPT- Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2021-09-20cli: Display all proxies in -getinfoklementtan
2021-09-16Merge bitcoin/bitcoin#22544: cli -addrinfo: drop torv2; torv3 becomes onion ↵W. J. van der Laan
per GetNetworkName() 49d503aefa74f11e5d93432987fa3775ed82c979 doc: update -addrinfo in release-notes.md and tor.md (Jon Atack) 75ea9ecf11bfeb120c58dc6c62539021a94ef97c cli -addrinfo: drop torv2, torv3 becomes onion per GetNetworkName() (Jon Atack) Pull request description: #22050 removed torv2 support from 22.0. For 23.0 and subsequent releases, we can probably remove torv2 from -addrinfo. before ``` "addresses_known": { "ipv4": 58305, "ipv6": 5138, "torv2": 0, "torv3": 5441, "i2p": 14, "total": 68898 } ``` after ``` "addresses_known": { "ipv4": 58305, "ipv6": 5138, "onion": 5441, "i2p": 14, "total": 68898 } ``` Per the naming of `netbase.{h, cpp}::GetNetworkName()`, torv3 becomes onion, which is what is printed in the output of getpeerinfo, getnetworkinfo and getnodeaddresses. ACKs for top commit: practicalswift: cr ACK 49d503aefa74f11e5d93432987fa3775ed82c979 Zero-1729: tACK 49d503aefa74f11e5d93432987fa3775ed82c979 🧉 klementtan: Code review and tested ACK 49d503aefa74f11e5d93432987fa3775ed82c979 Tree-SHA512: bca52520d8b12c26f1c329d661b9e22c567954ed2af7d2a16d7669eae1a221eada20944f8b2f4e78e31a7190d5f3d3fbfd37509e5edf2d9a3747a0a8f4e375bb
2021-09-09util: remove libevent <= 2.0.18 back-compat codefanquake
Now that we require libevent >=2.0.21, remove backwards compatibility code for older versions.
2021-09-05netinfo: clarify client and server versions in headerJon Atack
2021-09-02Merge bitcoin/bitcoin#22501: netinfo: display addr_{processed, rate_limited, ↵W. J. van der Laan
relay_enabled} and relaytxes data 218862a01848f69d54380c780bb5eae6dfdb1416 Display peers in -netinfo that we don't relay addresses to (Jon Atack) 3834e23b251ed7b4a47bbb981faba65b97ecbba0 Display peers in -netinfo that request we not relay transactions (Jon Atack) 0a9ee3a2c787e97213a0456b0d6253c549b71e09 Simplify a few conditionals in -netinfo (Jon Atack) 5eeea8e2575a36587e70743af3bd7c2d87b8cf36 Add addr_processed and addr_rate_limited stats to -netinfo (Jon Atack) Pull request description: Update CLI -netinfo to display the getpeerinfo `addr_processed`, `addr_rate_limited`, `addr_relay_enabled` and `relaytxes` data with auto-adjusting column widths. ``` $ ./src/bitcoin-cli -netinfo help txn Time since last novel transaction received from the peer and accepted into our mempool, in minutes "*" - the peer requested we not relay transactions to it (relaytxes is false) addrp Total number of addresses processed, excluding those dropped due to rate limiting "." - we do not relay addresses to this peer (addr_relay_enabled is false) addrl Total number of addresses dropped due to rate limiting ``` ![Screenshot from 2021-08-22 14-31-40](https://user-images.githubusercontent.com/2415484/130355514-f6fd4f21-79d6-463b-9791-de01ebef20b1.png) ACKs for top commit: 0xB10C: Code review and tested ACK 218862a01848f69d54380c780bb5eae6dfdb1416 Zero-1729: re-tACK 218862a01848f69d54380c780bb5eae6dfdb1416 vasild: ACK 218862a01848f69d54380c780bb5eae6dfdb1416 jarolrod: tACK 218862a01848f69d54380c780bb5eae6dfdb1416 Tree-SHA512: bb9da4bdd71859b234f6e4c2c46257a57ef0d0e0b363d2b8fded128bcaa28132f64a0a4651c622e1de1e3b7c05c7587a4369e9e79799895884fda9745c63409d
2021-08-24Fix typo in bitcoin-cli.cppKiminuo
2021-08-13Display peers in -netinfo that we don't relay addresses toJon Atack
i.e. peers where getpeerinfo#addr_relay_enabled is false
2021-08-13Display peers in -netinfo that request we not relay transactionsJon Atack
i.e. peers where getpeerinfo#relaytxes is false
2021-08-10Simplify a few conditionals in -netinfoJon Atack
2021-08-10Add addr_processed and addr_rate_limited stats to -netinfoJon Atack
2021-08-03cli: Add progress bar for -getinfoklementtan
Co-authored-by: jonatack <jon@atack.com>
2021-07-25cli -addrinfo: drop torv2, torv3 becomes onion per GetNetworkName()Jon Atack
2021-07-21cli: Implement human readable -getinfo.Klement Tan
2021-06-23cli: Avoid truncating -rpcwaittimeoutMarcoFalke
2021-06-03rpc: Prefix rpcwaittimeout error with details on its natureChristian Decker
As proposed by @laanwj the error message is now prefixed with the "timeout on transient error:" prefix, to explain why the error is suddenly considered terminal.
2021-06-03rpc: Add a `-rpcwaittimeout` parameter to limit time spent waitingChristian Decker
Adds a new numeric `-rpcwaittimeout` that can be used to limit the time we spend waiting on the RPC server to appear. This is used by downstream projects to provide a bit of slack when `bitcoind`s RPC interface is not available right away.
2021-05-31scripted-diff: rename GetSystemTimeInSeconds to GetTimeSecondsfanquake
-BEGIN VERIFY SCRIPT- sed -i -e 's/GetSystemTimeInSeconds/GetTimeSeconds/g' $(git grep -l GetSystemTimeInSeconds src) -END VERIFY SCRIPT-
2021-04-20cli: use C++17 std::array class template argument deduction (CTAD)Jon Atack
Credit to João Barbosa (promag) for the suggestions. Co-authored-by: João Barbosa <joao.paulo.barbosa@gmail.com>
2021-04-12addrinfo: raise helpfully on server error or incompatible server versionJon Atack