-
Notifications
You must be signed in to change notification settings - Fork 38.7k
rpc: Add optional peer_ids param to filter getpeerinfo #32741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
rpc: Add optional peer_ids param to filter getpeerinfo #32741
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32741. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
maflcko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please squash your commits according to https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commits
Also, missing tests?
|
I'm frequently using something like |
6285d75 to
85f4703
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
f1f5c11 to
4705d4e
Compare
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
a53bd91 to
53c5ce9
Compare
53c5ce9 to
af1c1df
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
danielabrozzoni
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK, I think this is a good addition, as introducing a peer_id parameter to filter the getpeerinfo response is useful for debugging.
This needs a release note :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK
Useful addition, I can see myself using the filtering here.
As mentioned in #32741 (review), a release note would be helpful as per this: https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#release-notes
7550c6f to
9393b33
Compare
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
This comment was marked as off-topic.
This comment was marked as off-topic.
43857ab to
599628a
Compare
|
Rebased on current master. |
rkrux
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crACK 599628ab9c23cd53a30fcbcb5d4ac370bb536547
| nonexistent_id = max(p["id"] for p in all_peers) + 1000 | ||
| assert_equal(node.getpeerinfo(nonexistent_id), []) | ||
| assert_raises_rpc_error(-8, "must be a number or an array of numbers", node.getpeerinfo, {}) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit if retouched:
diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py
index 209e804021..47834c8375 100755
--- a/test/functional/rpc_net.py
+++ b/test/functional/rpc_net.py
@@ -200,6 +200,7 @@ class NetTest(BitcoinTestFramework):
nonexistent_id = max(p["id"] for p in all_peers) + 1000
assert_equal(node.getpeerinfo(nonexistent_id), [])
assert_raises_rpc_error(-8, "must be a number or an array of numbers", node.getpeerinfo, {})
+ assert_equal(len(node.getpeerinfo([ids[0], nonexistent_id])), 1)
no_version_peer.peer_disconnect()
self.wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 2)599628a to
8471074
Compare
rkrux
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 8471074
3e28ffb to
e8764d8
Compare
|
the commit message is wrong? |
e8764d8 to
9b6090d
Compare
Thanks. Must've replaced it by mistake when I rebased. Fixed now |
danielabrozzoni
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK 9b6090d
I left a micro-nit, but I'd say avoid fixing it unless you already need to update, so you don't invalidate the ack :)
| "Returns data about each connected network peer as a json array of objects.", | ||
| {}, | ||
| "Returns data about each connected network peer as a json array of objects.\n" | ||
| "Optionally filter by peer ids.\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit if retouched: "peer IDs" (so it stays consistent with the rest of the help text)
rkrux
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm re-ACK 9b6090d
Adds an optional
peer_idsparameter togetpeerinfoto filter results by peer IDs.This is useful when using bitcoin-cli or the console to inspect specific peers referenced in debug.log.