Commit graph

33 commits

Author SHA1 Message Date
Wladimir J. van der Laan
23d3ae7acc
Merge #19405: rpc, cli: add network in/out connections to getnetworkinfo and -getinfo
581b343d5b Add in/out connections to cli -getinfo (Jon Atack)
d9cc13e88d UNIX_EPOCH_TIME fixup in rpc getnettotals (Jon Atack)
1ab49b81cf Add in/out connections to rpc getnetworkinfo (Jon Atack)

Pull request description:

  This is basic info that is present in the GUI that I've been wishing to have exposed via the RPC and CLI without needing a bash workaround or script. For human users it would also be useful to have it in `-getinfo`.

  `bitcoin-cli getnetworkinfo`
  ```
    "connections": 15,
    "connections_in": 6,
    "connections_out": 9,
  ```

  `bitcoin-cli -getinfo`
  ```
    "connections": {
      "in": 6,
      "out": 9,
      "total": 15
    },
  ```

  Update the tests, RPC help, and release notes for the changes. Also fixup the `getnettotals` timemillis help while touching `rpc/net.cpp`.

  -----

  Reviewers can manually test this PR by [building from source](https://jonatack.github.io/articles/how-to-compile-bitcoin-core-and-run-the-tests), launching bitcoind, and then running `bitcoin-cli -getinfo`, `bitcoin-cli getnetworkinfo`, `bitcoin-cli help getnetworkinfo`, and `bitcoin-cli help getnettotals` (for the UNIX epoch time change).

ACKs for top commit:
  eriknylund:
    > tACK [581b343](581b343d5b) on master at [a0a422c](a0a422c34c), ran unit & functional tests and and confirmed changes on an existing datadir ✌️
  benthecarman:
    tACK `581b343`
  willcl-ark:
    tACK for 581b343d5b, this time rebased onto master at 862fde88be.
  shesek:
    tACK `581b343`. This provides what I needed, thanks!
  n-thumann:
    tACK 581b343 on master at a0a422c, ran unit & functional tests and and confirmed changes on an existing datadir ✌️

Tree-SHA512: 08dd3ac8fefae401bd8253ff3ac027603c528eeccba53cedcb127771316173a7052fce44af8fa33ac98ebc4cf2a2b11cdefd949995d55e9b9a5942b876d00dc5
2020-09-04 15:09:37 +02:00
Seleme Topuz
1343c86c7c test: Update wait_until usage in tests not to use the one from utils
Replace "wait_until()" usage from utils, with the ones from BitcoinTestFramework and P2PInterface.
closes #19080
2020-08-26 18:01:59 +02:00
fanquake
e80e5b3e4f
Merge #19760: test: Remove confusing mininode terminology
d5800da519 [test] Remove final references to mininode (John Newbery)
5e8df3312e test: resort imports (John Newbery)
85165d4332 scripted-diff: Rename mininode to p2p (John Newbery)
9e2897d020 scripted-diff: Rename mininode_lock to p2p_lock (John Newbery)

Pull request description:

  New contributors are often confused by the terminology in the test framework, and what the difference between a _node_ and a _peer_ is. To summarize:

  - a 'node' is a bitcoind instance. This is the thing whose behavior is being tested. Each bitcoind node is managed by a python `TestNode` object which is used to start/stop the node, manage the node's data directory, read state about the node (eg process status, log file), and interact with the node over different interfaces.
  - one of the interfaces that we can use to interact with the node is the p2p interface. Each connection to a node using this interface is managed by a python `P2PInterface` or derived object (which is owned by the `TestNode` object). We can open zero, one or many p2p connections to each bitcoind node. The node sees these connections as 'peers'.

  For historic reasons, the word 'mininode' has been used to refer to those p2p interface objects that we use to connect to the bitcoind node (the code was originally taken from the 'mini-node' branch of https://github.com/jgarzik/pynode/tree/mini-node). However that name has proved to be confusing for new contributors, so rename the remaining references.

ACKs for top commit:
  amitiuttarwar:
    ACK d5800da519
  MarcoFalke:
    ACK d5800da519 🚞

Tree-SHA512: 2c46c2ac3c4278b6e3c647cfd8108428a41e80788fc4f0e386e5b0c47675bc687d94779496c09a3e5ea1319617295be10c422adeeff2d2bd68378e00e0eeb5de
2020-08-26 15:43:17 +08:00
Jon Atack
1ab49b81cf
Add in/out connections to rpc getnetworkinfo 2020-08-24 18:41:14 +02:00
John Newbery
5e8df3312e test: resort imports 2020-08-21 15:53:59 +01:00
John Newbery
85165d4332 scripted-diff: Rename mininode to p2p
-BEGIN VERIFY SCRIPT-
sed -i 's/\.mininode/\.p2p/g' $(git grep -l "mininode")
git mv test/functional/test_framework/mininode.py test/functional/test_framework/p2p.py
-END VERIFY SCRIPT-
2020-08-21 15:52:20 +01:00
Jon Atack
cfef5a2c98
test: rpc_net.py logging and test naming improvements 2020-08-15 15:13:40 +02:00
Jon Atack
21c57bacda
test: getpeerinfo last_block and last_transaction tests 2020-08-15 15:13:13 +02:00
Wladimir J. van der Laan
13c4635a3e
Merge #19696: rpc: Fix addnode remove command error
a51d0ad2de rpc: Improve addnode remove command error message (Fabian Jahr)

Pull request description:

  The `addnode` RPC with the `remove` command parameter is used to remove a node from the "added nodes". It did not have test coverage and in case of failure to remove the node it responded with the confusing message "Error: Node has not been added.".

  This PR adds test coverage and introduces a new error code as well as changes the error message to something that makes sense.

ACKs for top commit:
  laanwj:
    Code review ACK a51d0ad2de
  theStack:
    Tested ACK https://github.com/bitcoin/bitcoin/commit/a51d0ad2de

Tree-SHA512: 033ef5de0d4d49d58ef4df3759b838c9d19ee9dfb0aff9f814a3a63d124ca231a442c930efa7d343fe1f65727c4b59fc23dd5e26fe6ea69f9e84fda48b5c5cc2
2020-08-12 19:29:14 +02:00
John Newbery
37a480e0cd [net] Add addpeeraddress RPC method
Allows addresses to be added to Address Manager for testing.
2020-08-12 09:22:10 +01:00
John Newbery
ae8051bbd8 [test] Test that getnodeaddresses() can return all known addresses 2020-08-12 09:22:10 +01:00
Fabian Jahr
a51d0ad2de
rpc: Improve addnode remove command error message
This also adds test coverage for the remove command which was uncovered before.
2020-08-11 14:04:02 +02:00
Hennadii Stepanov
2aac093a3d
test: Add test coverage for -networkactive option 2020-07-22 22:55:48 +03:00
MarcoFalke
fa525e4d1c
net: Avoid wasting inv traffic during IBD 2020-06-19 09:27:30 -04:00
MarcoFalke
fa1433ac1b
rpc: Remove special case for unknown service flags 2020-05-29 18:17:18 -04: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
practicalswift
993e38a4e2 tests: Mark functional tests not supporting bitcoin-cli (--usecli) as such 2019-12-06 14:40:28 +00:00
MarcoFalke
696b5eb179
Merge #16987: test: Correct docstring param name.
e28d8f8936 Correct docstring param name. (John Bampton)

Pull request description:

  Small fix to correct the Python docstring.

ACKs for top commit:
  laanwj:
    ACK e28d8f8936
  MarcoFalke:
     ACK e28d8f8

Tree-SHA512: 7bec1c6b166c768dd69fc6b94eb80ceeaa0258985b9a11956e336940d403785e7d09d0084d9b870b637ec784db044cf4c0f8ac3f0fcdf431090f003016ef13a9
2019-09-30 12:12:59 -04:00
Luke Dashjr
9c23ebd6b1 qa: Fix service flag comparison check in rpc_net test 2019-09-30 11:45:47 +02:00
John Bampton
e28d8f8936 Correct docstring param name. 2019-09-30 12:15:18 +10:00
MarcoFalke
fa3b9ee8b2
scripted-diff: test: Replace connect_nodes_bi with connect_nodes
-BEGIN VERIFY SCRIPT-
sed -i --regexp-extended -e 's/connect_nodes_bi\(self.nodes,\s*(.),\s*/connect_nodes(self.nodes[\1], /g' $(git grep -l connect_nodes_bi)
sed -i --regexp-extended -e 's/connect_nodes_bi(,| )/connect_nodes\1/g'                                  $(git grep -l connect_nodes_bi)
-END VERIFY SCRIPT-
2019-09-17 13:08:21 -04:00
MarcoFalke
faaee1e39a
test: Use connect_nodes when connecting nodes in the test_framework 2019-09-17 13:08:17 -04:00
darosior
1d524c62ea
tests: rename 'test_getnetworkinginfo' in 'test_getnetworkinfo'
Since it's the name of the RPC call
2019-09-11 17:26:29 +02:00
darosior
07a8f65031
tests: add a test for the 'servicesnames' RPC field
In getpeerinfo and getnetworkinfo
2019-09-11 17:25:53 +02:00
Ben Woosley
de23739b22
test: Fix rpc_net.py "pong" race condition
Prior to this change, the test fails with KeyError if pong has
a zero value at the time this is called, as getpeerinfo's
bytesrecv_per_msg result excludes zero-values.

https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/21310881#L62
2019-01-01 13:12:41 -08:00
Jon Layton
fa0815c300
rpc: Correctly name arguments 2018-11-13 14:24:40 -05:00
chris-belcher
a2eb6f5405 [rpc] Add getnodeaddresses RPC command
New getnodeaddresses call gives access via RPC to the peers known by
the node. It may be useful for bitcoin wallets to broadcast their
transactions over tor for improved privacy without using the
centralized DNS seeds. getnodeaddresses is very similar to the getaddr
p2p method.

Tests the new rpc call by feeding IP address to a test node via the p2p
protocol, then obtaining someone of those addresses with
getnodeaddresses and checking that they are a subset.
2018-09-17 22:55:23 +01:00
Anthony Towns
5778bf95d9 Report minfeefilter value in getpeerinfo rpc
Lowering the minimum relay fee is only useful when many nodes in the
p2p network also lower the fee, so to make it easier to understand
progress on that front, this includes the value of the minfeefilter in
getpeerinfo, so you at least have visibility to what fees your neighbours
are currently accepting.
2018-08-27 21:13:15 +10:00
DrahtBot
eb7daf4d60 Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
John Newbery
5a67c0524e [tests] Fix intermittent rpc_net.py failure.
rpc_net.py would intermittently fail on Travis, probably
due to assuming that two consecutive RPC calls were atomic.
Fix this by only testing that amounts are bounded above and
below rather than equal.
2018-03-28 15:35:35 -04:00
Ben Woosley
81b0822772
test: Use wait_until in tests where time was used for polling 2018-03-15 23:43:53 -07:00
Ben Woosley
0eb84f30d8
test: Use wait_until to ensure ping goes out
Intermittent failure evident here:
https://travis-ci.org/bitcoin/bitcoin/jobs/344021180
2018-02-26 13:58:43 -08:00
Anthony Towns
81b79f2c39 [tests] Rename rpc_* functional tests. 2018-01-25 09:44:29 +10:00
Renamed from test/functional/net.py (Browse further)