Commit graph

200 commits

Author SHA1 Message Date
fanquake
e213382920
Merge #21029: bitcoin-cli: Correct docs (no "generatenewaddress" exists)
71430aec43 bitcoin-cli: Correct docs (no "generatenewaddress" exists) (Luke Dashjr)

Pull request description:

ACKs for top commit:
  jonatack:
    ACK 71430aec43

Tree-SHA512: 45ee7a51080598141fac4446563bdf99a59bfaa0ee00d9e092511087a968e8535d9208683ed589be1c975531be6d0319d33720f1f0dc1c3635c7d5ea6d726a41
2021-01-29 11:36:57 +08:00
Luke Dashjr
71430aec43 bitcoin-cli: Correct docs (no "generatenewaddress" exists) 2021-01-29 00:38:57 +00:00
Jon Atack
6f2c4fd077
netinfo: add user help documentation
and drop no longer needed sort description header to save screen space
2021-01-05 21:31:48 +01:00
Jon Atack
398045ba8b
cli -netinfo: print oversized/extreme ping times as "-" 2020-10-25 16:51:21 +01:00
Jon Atack
773f4c99c0
cli -netinfo: handle longer tor v3 local addresses 2020-10-25 16:51:18 +01:00
Jon Atack
33e987452f
cli -netinfo: make age column variable-width
as it has a wide possible range and the new name ("age" instead of "uptime") is
much shorter.
2020-10-25 16:22:55 +01:00
Jon Atack
f8a1c4d946
cli -netinfo: various quick updates and fixes
- add new signet chain

- update change "uptime" column name to "age" per suggestion by 0xB10C (Timo)

- add an additional digit to mping field width

- change m_networks_size from size_t to uint8_t, as size_t was a holdover
  from m_networks_size being defined as size_t m_networks.size() in a draft

- order Peer struct members by decreasing memory size
2020-10-25 16:15:56 +01:00
Jon Atack
6272604bef
refactor: enable -netinfo to add future networks (i2p, cjdns)
After this commit, a new network may be added by changing 4 lines:
- increment the value of `m_networks_size`
- add the network name to `m_networks`
- add the network name to this line: `result += "        ipv4    ipv6   onion   total  block-relay\n";`
- add "counts.at(i).at(<m_networks pos>)" to this line: `result += strprintf("%-5s  %5i   %5i   %5i   %5i   %5i\n...`
2020-10-14 16:29:37 +02:00
Jon Atack
82fd40216c
refactor: promote some -netinfo localvars to class members 2020-10-14 14:56:07 +02:00
Jon Atack
5133fab37e
cli: simplify -netinfo using getpeerinfo network field 2020-10-14 14:56:05 +02:00
Wladimir J. van der Laan
7eab781a14 rpc: Set HTTP Content-Type in bitcoin-cli
We don't set any `Content-Type` in the client. It is more
consistent with our other JSON-RPC use to set it to `application/json`.

Note that our server doesn't enforce content types, so it doesn't make a
difference in practice. But it is fairly strange HTTP behavior to not set it.

This came up in #18950.
2020-10-01 17:33:56 +02:00
Hennadii Stepanov
b3972bca9f
doc: Mention signet in -help output 2020-09-25 15:23:01 +03:00
MarcoFalke
faf0a26711
doc: Update comments for new chain settings (-signet and -chain=signet) 2020-09-22 22:32:25 +02:00
fanquake
a33651866c
Merge #19643: Add -netinfo peer connections dashboard
bf1f913c44 cli -netinfo: display multiple levels of details (Jon Atack)
077b3ac928 cli: change -netinfo optional arg from bool to int (Jon Atack)
4e2f2ddd64 cli: add getpeerinfo last_{block,transaction} to -netinfo (Jon Atack)
644be659ab cli: add -netinfo server version check and error message (Jon Atack)
ce57bf6cc0 cli: create peer connections report sorted by dir, minping (Jon Atack)
f5edd66e5d cli: create vector of Peer structs for peers data (Jon Atack)
3a0ab93e1c cli: add NetType enum struct and NetTypeEnumToString() (Jon Atack)
c227100919 cli: create local addresses, ports, and scores report (Jon Atack)
d3f77b736e cli: create inbound/outbound peer connections report (Jon Atack)
19377b2fd2 cli: start dashboard report with chain and version header (Jon Atack)
a3653c159e cli: tally peer connections by type (Jon Atack)
54799b66b4 cli: add ipv6 and onion address type detection helpers (Jon Atack)
12242b17a5 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 bf1f913c44
  practicalswift:
    ACK bf1f913c44 -- patch looks correct and is limited to `src/bitcoin-cli.cpp`

Tree-SHA512: b9d18e5cc2ffd2bb9f0295b5ac7609da8a9bbecaf823a26dfa706b5f07d5d1a8343081dad98b16aa9dc8efd8f41bc1a4acdc40259727de622dc7195ccf59c572
2020-09-15 15:01:50 +08:00
Jon Atack
bf1f913c44
cli -netinfo: display multiple levels of details 2020-09-02 16:24:23 +02:00
Jon Atack
077b3ac928
cli: change -netinfo optional arg from bool to int 2020-08-31 16:13:29 +02:00
Jon Atack
4e2f2ddd64
cli: add getpeerinfo last_{block,transaction} to -netinfo 2020-08-31 16:13:26 +02:00
Jon Atack
644be659ab
cli: add -netinfo server version check and error message 2020-08-31 16:13:17 +02:00
Jon Atack
ce57bf6cc0
cli: create peer connections report sorted by dir, minping 2020-08-31 16:12:44 +02:00
Jon Atack
f5edd66e5d
cli: create vector of Peer structs for peers data 2020-08-31 16:12:36 +02:00
Jon Atack
3a0ab93e1c
cli: add NetType enum struct and NetTypeEnumToString() 2020-08-31 16:12:04 +02:00
Jon Atack
c227100919
cli: create local addresses, ports, and scores report 2020-08-31 16:12:01 +02:00
Jon Atack
d3f77b736e
cli: create inbound/outbound peer connections report 2020-08-31 16:11:59 +02:00
Jon Atack
19377b2fd2
cli: start dashboard report with chain and version header 2020-08-31 16:11:51 +02:00
Jon Atack
a3653c159e
cli: tally peer connections by type 2020-08-31 16:11:09 +02:00
Jon Atack
54799b66b4
cli: add ipv6 and onion address type detection helpers 2020-08-30 22:37:45 +02:00
Jon Atack
12242b17a5
cli: create initial -netinfo option, NetinfoRequestHandler class 2020-08-30 22:37:06 +02:00
Jon Atack
581b343d5b
Add in/out connections to cli -getinfo 2020-08-24 18:41:24 +02:00
Ivan Metlushko
9b20f66828 scripted-diff: Replace gArgs with local argsman
-BEGIN VERIFY SCRIPT-
sed -i -e 's/gArgs.Add/argsman.Add/g' `git grep -l "gArgs.Add"`
-END VERIFY SCRIPT-
2020-07-29 16:39:00 +07:00
Ivan Metlushko
a316e9ce26 refactor: add unused ArgsManager to replace gArgs 2020-07-29 16:36:44 +07:00
Jon Atack
f20b359bb9
cli: reduce DefaultRequestHandler memory allocations 2020-07-05 16:39:17 +02:00
Jon Atack
4b859cfff9
cli: add multiwallet capability to GetNewAddress and -generate 2020-06-02 08:50:51 +02:00
Jon Atack
4818124137
cli: create bitcoin-cli -generate command 2020-06-02 08:50:45 +02:00
Jon Atack
ff41a36900
cli: extract ParseResult() and ParseError()
and make callable higher up with (nRet == 0) check.
2020-06-02 08:50:41 +02:00
Harris
f4185b26d9
cli: create GenerateToAddressRequestHandler class 2020-06-02 08:50:36 +02:00
Jon Atack
f7c65a3350
cli: create GetNewAddress() 2020-06-02 08:24:29 +02:00
MarcoFalke
9ccaee1d5e
Merge #19004: refactor: Replace const char* to std::string
c57f03ce17 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 c57f03ce17
  practicalswift:
    ACK c57f03ce17 -- patch looks correct
  hebasto:
    re-ACK c57f03ce17

Tree-SHA512: 9ce99bb38fe399b54844315048204cafce0f27fd8f24cae357fa7ac6f5d8094d57bbf5f5c1f5878a65f2d35e4a3f95d527eb17f49250b690c591c0df86ca84fd
2020-05-27 07:16:10 -04:00
Calvin Kim
c57f03ce17 refactor: Replace const char* to std::string
Some functions should be returning std::string instead of const char*.
This commit changes that.
2020-05-22 01:40:31 +09:00
Jon Atack
903b6c117f
rpc: drop unused JSONRPCProcessBatchReply size arg, refactor 2020-05-21 10:24:26 +02:00
Jon Atack
afce85eb99
cli: use GetWalletBalances() functionality for -getinfo
and replace GetBoolArg with IsArgSet as we only want
to know if the arg is passed; we do not need the value.
2020-05-21 10:24:23 +02:00
Jon Atack
9f01849a49
cli: create GetWalletBalances() to fetch multiwallet balances 2020-05-21 10:24:20 +02:00
Jon Atack
743077544b
cli: lift -rpcwallet logic up to CommandLineRPC()
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-21 10:24:17 +02:00
Jon Atack
29f2cbdeb7
cli: extract connection exception handler, -rpcwait logic
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-05-21 10:23:48 +02:00
fanquake
315a4d36f7
build: fix ASLR for bitcoin-cli on Windows
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-19 10:05:29 +08:00
MarcoFalke
fa488f131f
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
2020-04-16 13:33:09 -04:00
MarcoFalke
4eb1eeb02c
Merge #18504: build: Drop bitcoin-tx and bitcoin-wallet dependencies on libevent
01a3392b1b Drop bitcoin-wallet dependency on libevent (Russell Yanofsky)
0660119ac3 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 01a3392b1b.

Tree-SHA512: d2245e912ab494cccceeb427a1eca8e55b01a0006ff93eebcfb5461ae7cecd1083ac2de443d9db036b18bdc6f0fb615546caaa20c585046f66d234937f74870a
2020-04-10 12:52:37 -04:00
Jon Atack
75019774c9
cli -getinfo: use getbalances instead of deprecated getwalletinfo balance 2020-04-09 15:42:43 +02:00
Russell Yanofsky
01a3392b1b Drop bitcoin-wallet dependency on libevent
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-04-02 08:35:10 -04:00
MarcoFalke
fa9af06d91
scripted-diff: Replace MilliSleep with UninterruptibleSleep
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-
2020-02-21 10:06:21 -08:00
MarcoFalke
aaaaad6ac9
scripted-diff: Bump copyright of files changed in 2019
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
2019-12-30 10:42:20 +13:00