Additional field to RPC getpeerinfo output: addrlocal#2929
Additional field to RPC getpeerinfo output: addrlocal#2929laanwj merged 1 commit intobitcoin:masterfrom
Conversation
|
You should squash into one single commit. |
|
Thanks for the feedback! Done. Nicely squashed now. |
|
ACK the code change... what is the use case? How is this useful? |
|
Thanks! Use case is to help network troubleshooting. In my example, I was having a tough time because I couldn't tell if my external IP address was being seen correctly by the outside world. Bitcoin exchanges this information during the "version" command handling, and stores it in the "addrLocal" member of CNode, but doesn't expose this to the user, so unless the user is lucky and sees the debug text scroll by at the moment a connection is made, the user won't be able to easily learn this information. Also, it might be nice in the future to have a table of network connections in Bitcoin-Qt or something like that, and this would make it easy to have both local and remote addresses appear in the table (for completeness). |
There was a problem hiding this comment.
Nit: this can be a CService instead of a full CAddress, I suppose.
|
ACK |
|
Thanks. I found the methods worked the same when simply reusing the existing CService, so there's no need to construct a CAddress here. |
|
Found and removed a needless usage of c_str(). |
There was a problem hiding this comment.
I'm not sure if an empty string, n/a or just to hide the addrlocal filed would be best...
There was a problem hiding this comment.
Thanks for the thought. I actually hide the addrlocal field from the output entirely, in the getpeerinfo handler, if it's blank. If local address is not known yet, the output is unchanged from upstream.
Thought about adding the field anyway but leaving it as an empty string, but that just added bloat to the output. Using n/a instead introduces a magic constant string that conveys no more information than an empty string.
|
No change made, just rebased this branch to catch it up to the latest master. |
|
Rebase needed again. |
The existing CNode::addrLocal member is revealed to the user, as an address string, similar to the existing "addr" field. Instead of showing garbage or empty string, it simply will not appear in the output if local address not known yet.
|
Rebased! Thanks for the reminder. |
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/547c61f8d8b42296fd0a51bad4a2e3a3765aa7fd for binaries and test log. |
Additional field to RPC getpeerinfo output: addrlocal
This simple patch gives user visibility to see the contents of the existing CNode::addrLocal member.
No existing behavior is changed, this is read-only.
If addrLocal is invalid (not filled in yet), the field will not be included in the output.