aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-cli.cpp
AgeCommit message (Collapse)Author
2020-09-15Merge #19643: Add -netinfo peer connections dashboardfanquake
bf1f913c4405cba35c8f99ec07b407940eb955b6 cli -netinfo: display multiple levels of details (Jon Atack) 077b3ac9284a90f33e31c64c49062ceaf815af60 cli: change -netinfo optional arg from bool to int (Jon Atack) 4e2f2ddd6444d93dd7e60ec67cc393dfc2a29b9d cli: add getpeerinfo last_{block,transaction} to -netinfo (Jon Atack) 644be659abfcf7c638e17795bafedad73bc55b27 cli: add -netinfo server version check and error message (Jon Atack) ce57bf6cc0cdaf8233fd8a20e0d1c5b69d17d2a3 cli: create peer connections report sorted by dir, minping (Jon Atack) f5edd66e5d136b229c805af9e6ea73218f6cedde cli: create vector of Peer structs for peers data (Jon Atack) 3a0ab93e1ce8d91235a6d46a57c6cb110fc5bf03 cli: add NetType enum struct and NetTypeEnumToString() (Jon Atack) c227100919dd2422b29eb3bca9c0f1a7983cc3a8 cli: create local addresses, ports, and scores report (Jon Atack) d3f77b736e43b187771b901a6a3452f83c116918 cli: create inbound/outbound peer connections report (Jon Atack) 19377b2fd24704bff6c805946575b116f07d5e0d cli: start dashboard report with chain and version header (Jon Atack) a3653c159e4f5c887eec9ea608e474eaa299fc07 cli: tally peer connections by type (Jon Atack) 54799b66b466c0d015e6fe2f820663cc5d8e7998 cli: add ipv6 and onion address type detection helpers (Jon Atack) 12242b17a52c9833e6504f3f0a5b247a6e2fc5f9 cli: create initial -netinfo option, NetinfoRequestHandler class (Jon Atack) Pull request description: This PR is inspired by laanwj's python script mentioned in #19405, which it turns out I ended up using every day and extending because I got hooked on using it to monitor Bitcoin peer connections. For the full experience, run `./src/bitcoin-cli -netinfo 4` On Linux, try it with watch `watch ./src/bitcoin-cli -netinfo 4` Help doc ``` $ ./src/bitcoin-cli -help | grep -A3 netinfo -netinfo Get network peer connection information from the remote server. An optional integer argument from 0 to 4 can be passed for different peers listings (default: 0). ``` ACKs for top commit: vasild: ACK bf1f913 0xB10C: ACK bf1f913c4405cba35c8f99ec07b407940eb955b6 practicalswift: ACK bf1f913c4405cba35c8f99ec07b407940eb955b6 -- patch looks correct and is limited to `src/bitcoin-cli.cpp` Tree-SHA512: b9d18e5cc2ffd2bb9f0295b5ac7609da8a9bbecaf823a26dfa706b5f07d5d1a8343081dad98b16aa9dc8efd8f41bc1a4acdc40259727de622dc7195ccf59c572
2020-09-02cli -netinfo: display multiple levels of detailsJon Atack
2020-08-31cli: change -netinfo optional arg from bool to intJon Atack
2020-08-31cli: add getpeerinfo last_{block,transaction} to -netinfoJon Atack
2020-08-31cli: add -netinfo server version check and error messageJon Atack
2020-08-31cli: create peer connections report sorted by dir, minpingJon Atack
2020-08-31cli: create vector of Peer structs for peers dataJon Atack
2020-08-31cli: add NetType enum struct and NetTypeEnumToString()Jon Atack
2020-08-31cli: create local addresses, ports, and scores reportJon Atack
2020-08-31cli: create inbound/outbound peer connections reportJon Atack
2020-08-31cli: start dashboard report with chain and version headerJon Atack
2020-08-31cli: tally peer connections by typeJon Atack
2020-08-30cli: add ipv6 and onion address type detection helpersJon Atack
2020-08-30cli: create initial -netinfo option, NetinfoRequestHandler classJon Atack
2020-08-24Add in/out connections to cli -getinfoJon Atack
2020-07-29scripted-diff: Replace gArgs with local argsmanIvan Metlushko
-BEGIN VERIFY SCRIPT- sed -i -e 's/gArgs.Add/argsman.Add/g' `git grep -l "gArgs.Add"` -END VERIFY SCRIPT-
2020-07-29refactor: add unused ArgsManager to replace gArgsIvan Metlushko
2020-07-05cli: reduce DefaultRequestHandler memory allocationsJon Atack
2020-06-02cli: add multiwallet capability to GetNewAddress and -generateJon Atack
2020-06-02cli: create bitcoin-cli -generate commandJon Atack
2020-06-02cli: extract ParseResult() and ParseError()Jon Atack
and make callable higher up with (nRet == 0) check.
2020-06-02cli: create GenerateToAddressRequestHandler classHarris
2020-06-02cli: create GetNewAddress()Jon Atack
2020-05-27Merge #19004: refactor: Replace const char* to std::stringMarcoFalke
c57f03ce1741b38af448bec7b22ab9f8ac21f067 refactor: Replace const char* to std::string (Calvin Kim) Pull request description: Rationale: Addresses #19000 Some functions should be returning std::string instead of const char*. This commit changes that. Main benefits/reasoning: 1. The functions never return nullptr, so returning a string makes code at call sites easier to review (reviewers don't have to read the source code to verify that a nullptr is never returned) 2. All call sites convert to string anyway ACKs for top commit: MarcoFalke: re-ACK c57f03ce17 (no changes since previous review) 🚃 Empact: Fair enough, Code Review ACK https://github.com/bitcoin/bitcoin/pull/19004/commits/c57f03ce1741b38af448bec7b22ab9f8ac21f067 practicalswift: ACK c57f03ce1741b38af448bec7b22ab9f8ac21f067 -- patch looks correct hebasto: re-ACK c57f03ce1741b38af448bec7b22ab9f8ac21f067 Tree-SHA512: 9ce99bb38fe399b54844315048204cafce0f27fd8f24cae357fa7ac6f5d8094d57bbf5f5c1f5878a65f2d35e4a3f95d527eb17f49250b690c591c0df86ca84fd
2020-05-22refactor: Replace const char* to std::stringCalvin Kim
Some functions should be returning std::string instead of const char*. This commit changes that.
2020-05-21rpc: drop unused JSONRPCProcessBatchReply size arg, refactorJon Atack
2020-05-21cli: use GetWalletBalances() functionality for -getinfoJon Atack
and replace GetBoolArg with IsArgSet as we only want to know if the arg is passed; we do not need the value.
2020-05-21cli: create GetWalletBalances() to fetch multiwallet balancesJon Atack
2020-05-21cli: lift -rpcwallet logic up to CommandLineRPC()Jon Atack
to allow passing rpcwallet independently from the -rpcwallet user option, and to move the logic to the top-level layer where most of the other option args are handled.
2020-05-21cli: extract connection exception handler, -rpcwait logicJon Atack
to ConnectAndCallRPC() to be callable for individual connections. This is needed for RPCs that need to be called and handled sequentially, rather than alone or in a batch. For example, when fetching the balances for each loaded wallet, -getinfo will call RPC listwallets, and then, depending on the result, RPC getbalances. It may be somewhat helpful to review this commit with `git show -w`.
2020-04-19build: fix ASLR for bitcoin-cli on Windowsfanquake
ASLR is not currently working for the bitcoin-cli.exe binary. This is due to it not having a .reloc section, which is stripped by default by the mingw-w64 ld we use for gitian builds. A good summary of issues with ld and mingw-w64 is available in this thread: https://sourceware.org/bugzilla/show_bug.cgi?id=19011. All other Windows binaries that we distribute (bitcoind, bitcoin-qt, bitcoin-wallet, bitcoin-tx and test_bitcoin) do not suffer this issue, and currently having working ASLR. This is due to them exporting (inadvertent or not) libsecp256k1 symbols, and, as a result, the .reloc section is not stripped by ld. This change is a temporary workaround, also the same one described here: https://www.kb.cert.org/vuls/id/307144/, that causes main() to be exported. Exporting a symbol will mean that the .reloc section is not stripped, and ASLR will function correctly.
2020-04-16scripted-diff: Bump copyright headersMarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2020-04-10Merge #18504: build: Drop bitcoin-tx and bitcoin-wallet dependencies on libeventMarcoFalke
01a3392b1b778fa4fcf568013326d6ea1de4fb3b Drop bitcoin-wallet dependency on libevent (Russell Yanofsky) 0660119ac372c2863d14060ac1bc9bc243771f94 Drop unintended bitcoin-tx dependency on libevent (Russell Yanofsky) Pull request description: This fixes compile errors trying to build bitcoin-tx and bitcoin-wallet without libevent, which were reported by Luke Dashjr in https://github.com/bitcoin/bitcoin/issues/18465 The fix avoiding `bitcoin-tx` dependency on libevent just adds a conditional build rule. This is implemented in the first commit (more details in commit description). The fix avoiding `bitcoin-wallet` dependency on libevent requires minor code changes, because `bitcoin-wallet` (unlike `bitcoin-tx`) links against code that calls `urlDecode` / `evhttp_uridecode`. This fix is implemented in the second commit (again details in the commit description). ACKs for top commit: jonasschnelli: utACK 01a3392b1b778fa4fcf568013326d6ea1de4fb3b. Tree-SHA512: d2245e912ab494cccceeb427a1eca8e55b01a0006ff93eebcfb5461ae7cecd1083ac2de443d9db036b18bdc6f0fb615546caaa20c585046f66d234937f74870a
2020-04-09cli -getinfo: use getbalances instead of deprecated getwalletinfo balanceJon Atack
2020-04-02Drop bitcoin-wallet dependency on libeventRussell Yanofsky
Don't require urlDecode function in wallet code since urlDecode implementation currently uses libevent. Just call urlDecode indirectly though URL_DECODE function pointer constant if available. In bitcoind and bitcoin-qt, URL_DECODE is implemented and used to interpret RPC wallet requests. In bitcoin-wallet, URL_DECODE is null to avoid depending on libevent.
2020-02-21scripted-diff: Replace MilliSleep with UninterruptibleSleepMarcoFalke
This is safe because MilliSleep is never executed in a boost::thread, the only type of thread that is interruptible. * The RPC server uses std::thread * The wallet is either executed in an RPC thread or the main thread * bitcoin-cli, benchmarks and tests are only one thread (the main thread) -BEGIN VERIFY SCRIPT- sed -i --regexp-extended -e 's/MilliSleep\((\S+)\);/UninterruptibleSleep(std::chrono::milliseconds{\1});/g' $(git grep -l MilliSleep) -END VERIFY SCRIPT-
2019-12-30scripted-diff: Bump copyright of files changed in 2019MarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2019-12-04util: remove unwanted fields from bitcoin-cli -getinfomalevolent
In accordance with #17314, Removing noisy fields from -getinfo. Fields removed: protocolversion, walletversion and keypoololdest. In addition to changing bitcoin-cli -getinfo, there is another change to test/functional/interface_bitcoin_cli.py. This change deletes tests that utilize removed -getinfo calls.
2019-11-04cli: fix -getinfo output when compiled with no walletfanquake
2019-10-30Merge #17302: cli: Add "headers" and "verificationprogress" to -getinfoWladimir J. van der Laan
31879345ee9a222b12014c8b2359e1737ff0d8c4 cli: Add "headers" and "verificationprogress" to -getinfo (Wladimir J. van der Laan) Pull request description: These values are useful to know the current progress of initial sync, or of catching up, which is arguably the use of a quick `-getinfo` command. ACKs for top commit: MarcoFalke: unsigned ACK 31879345ee9a222b12014c8b2359e1737ff0d8c4 jonasschnelli: utACK 31879345ee9a222b12014c8b2359e1737ff0d8c4 jonatack: Tested ACK 31879345ee9a222b12014c8b2359e1737ff0d8c4 on Debian 4.19.37-5+deb10u2 (2019-08-08) x86_64 GNU/Linux Tree-SHA512: 185180ab426b4db5d99eb208ee88d1606f585361875ba3a92b6c28a74fe181d72ed710c8859b969ba49b1ca7d2385695932b79ff621c7a2a7cedd0df717a99ed
2019-10-30Merge #17280: refactor: Change occurences of c_str() used with size() to data()Wladimir J. van der Laan
f3b51eb9352d7a7c5dfa15615efc8bc0a52ffecf Fix occurences of c_str() used with size() to data() (Wladimir J. van der Laan) Pull request description: Using `data()` better communicates the intent here. ~~Also, depending on how `c_str()` is implemented, this fixes undefined behavior: The part of the string after the first NULL character might have undefined contents (or even be inaccessible, worst case).~~ Apparently [this is no longer an issue with C++11](https://github.com/bitcoin/bitcoin/pull/17281#discussion_r339742128). ACKs for top commit: fjahr: Code review ACK f3b51eb practicalswift: ACK f3b51eb9352d7a7c5dfa15615efc8bc0a52ffecf -- diff looks correct, `data()` more idiomatic ryanofsky: Code review ACK f3b51eb9352d7a7c5dfa15615efc8bc0a52ffecf. Most of these calls (including one in crypter.cpp) are passing text strings, not binary strings likely to contain `\0` and were probably safe before, but much better to avoid the possibility of bugs like this. Tree-SHA512: 842e1bdd37efc4ece2ecb87ca34962aafef0a192180051def630607e349dc9c8b4e562481fff3de474515f493b4ee3ea53b00269a801a66e625326a38dfce5b8
2019-10-29cli: Add "headers" and "verificationprogress" to -getinfoWladimir J. van der Laan
These value are useful to know the current progress of initial sync, or of catching up.
2019-10-28Fix occurences of c_str() used with size() to data()Wladimir J. van der Laan
Using `data()` better communicates the intent here. Also, depending on how `c_str()` is implemented, this fixes undefined behavior: The part of the string after the first NULL character might have undefined contents.
2019-10-28refactor: Remove redundant c_str() calls in formattingWladimir J. van der Laan
Our formatter, tinyformat, *never* needs `c_str()` for strings. Remove redundant `c_str()` calls for: - `strprintf` - `LogPrintf` - `tfm::format`
2019-10-16Merge #16659: refactoring: Remove unused includesMarcoFalke
084e17cebd424b8e8ced674bc810eef4e6ee5d3b Remove unused includes (practicalswift) Pull request description: As requested by MarcoFalke in https://github.com/bitcoin/bitcoin/pull/16273#issuecomment-521332089: This PR removes unused includes. Please note that in contrast to #16273 I'm limiting the scope to the trivial cases of pure removals (i.e. no includes added) to make reviewing easier. I'm seeking "Concept ACK":s for this obviously non-urgent minor cleanup. Rationale: * Avoids unnecessary re-compiles in case of header changes. * Makes reasoning about code dependencies easier. * Reduces compile-time memory usage. * Reduces compilation time. * Warm fuzzy feeling of being lean :-) ACKs for top commit: ryanofsky: Code review ACK 084e17cebd424b8e8ced674bc810eef4e6ee5d3b. PR only removes include lines and it still compiles. In the worst case someone might have to explicitly add an include later for something now included implicitly. But maybe some effort was taken to avoid this, and it wouldn't be a tragedy anyway. Tree-SHA512: 89de56edc6ceea4696e9579bccff10c80080821685b9fb4e8c5ef593b6e43cf662f358788701bb09f84867693f66b2e4db035b92b522a0a775f50b7ecffd6a6d
2019-10-15Remove unused includespracticalswift
2019-10-15rpc: fix -rpcclienttimeout 0 optionFabian Jahr
2019-10-01add newline after -stdin*Karl-Johan Alm
2019-10-01cli: add -stdinwalletpassphrase for (slightly more) secure CLIKarl-Johan Alm
2019-09-06Testchains: Generic selection with -chain=<str> in addition of -testnet and ↵Jorge Timón
-regtest