[RPC] Add connection type to getpeerinfo, improve logs #19725

pull amitiuttarwar wants to merge 5 commits into bitcoin:master from amitiuttarwar:2020-08-getpeerinfo-conn-type changing 9 files +99 −32
  1. amitiuttarwar commented at 2:26 am on August 15, 2020: contributor

    After #19316, we can more directly expose information about the connection type on the getpeerinfo RPC. Doing so also makes the existing addnode field redundant, so this PR begins the process of deprecating this field.

    This PR also includes one commit that improves a log message, as both use a shared function to return the connection type as a string.

    Suggested by sdaftuar- #19316 (review) & #19316 (review)

  2. fanquake added the label RPC/REST/ZMQ on Aug 15, 2020
  3. amitiuttarwar renamed this:
    [RPC] Add connection type to getpeerinfo
    [RPC] Add connection type to getpeerinfo, improve logs
    on Aug 15, 2020
  4. amitiuttarwar force-pushed on Aug 15, 2020
  5. in doc/release-notes.md:119 in 26baed4087 outdated
    114+  the type of connection established with the peer. It will return one of six
    115+  options: 1. outbound full relay (default automatic connections) 2. block
    116+  relay only (connections that only relay blocks, not transactions or
    117+  addresses) 3. inbound (connection initiated by the peer) 4. manual (peers
    118+  added via addnode or -connect configuration param) 5. feeler / 6. addrfetch
    119+  (both short lived automatic connections used for robustness).
    


    MarcoFalke commented at 6:18 am on August 15, 2020:
    nit: instead of adding extended documentation to the release notes, the documentation can be added to the rpc itself. Affected/interested users can call help rpc_method or --help if needed.

    amitiuttarwar commented at 7:38 pm on August 17, 2020:
    okay, removed the specifics. better?
  6. in src/net.h:878 in 26baed4087 outdated
    874@@ -874,6 +875,25 @@ class CNode
    875         assert(false);
    876     }
    877 
    878+    std::string ConnectionTypeToString() const {
    


    MarcoFalke commented at 6:20 am on August 15, 2020:
    For new code it would make sense to properly clang-format it. See e.g. https://github.com/bitcoin/bitcoin/tree/master/contrib/devtools#clang-format-diffpy

    amitiuttarwar commented at 7:39 pm on August 17, 2020:
    thanks, think I’ve updated all the commits with proper clang formatting. moving forward, will try to incorporate this into my workflow.
  7. luke-jr commented at 6:23 am on August 15, 2020: member
    This seems strangely implementation-specific to me. I think we should at least keep a simple connection direction somewhere?
  8. in src/net.h:889 in 26baed4087 outdated
    884+            case ConnectionType::FEELER:
    885+                return "feeler";
    886+            case ConnectionType::OUTBOUND:
    887+                return "outbound full relay";
    888+            case ConnectionType::BLOCK_RELAY:
    889+                return "block relay only";
    


    MarcoFalke commented at 6:24 am on August 15, 2020:
    nit: Would it make sense to replace the spaces with - to preserve the previous format of the log message? Also, if this was used in an arbitrary sentence, it might not be clear that this is a single word/“operator”

    amitiuttarwar commented at 7:39 pm on August 17, 2020:
    done
  9. in src/rpc/net.cpp:137 in 26baed4087 outdated
    133@@ -133,6 +134,10 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
    134                                                               "When a message type is not listed in this json object, the bytes received are 0.\n"
    135                                                               "Only known message types can appear as keys in the object and all bytes received of unknown message types are listed under '"+NET_MESSAGE_COMMAND_OTHER+"'."}
    136                             }},
    137+                            {RPCResult::Type::STR, "connection_type", "Type of connection: outbound full relay (default automatic connections),\n"
    


    MarcoFalke commented at 6:27 am on August 15, 2020:
    0                            {RPCResult::Type::STR, "connection_type", "Type of connection:\n " + Join(foobar, ",\n") + "."},
    

    What about moving the connection type documentation into a global like NET_PERMISSIONS_DOC?


    amitiuttarwar commented at 7:40 pm on August 17, 2020:
    done
  10. in doc/release-notes.md:110 in 26baed4087 outdated
    101@@ -102,6 +102,22 @@ will trigger BIP 125 (replace-by-fee) opt-in. (#11413)
    102   option `-deprecatedrpc=banscore` is used. The `banscore` field will be fully
    103   removed in the next major release. (#19469)
    104 
    105+- The `getpeerinfo` RPC no longer returns the `inbound` or `addnode` fields by
    106+  default. These two fields will be fully removed in the next major release.
    107+  They can be accessed with the configuration options
    108+  `-deprecatedrpc=getpeerinfo_inbound` and `-deprecatedrpc=getpeerinfo_addnode`
    109+  respectively. However, it is recommended to instead use the `connection_type`
    110+  field, which will indicate whether the peer is inbound, addnode(manual), or
    


    MarcoFalke commented at 6:30 am on August 15, 2020:
    0  field.
    

    Probably can remove the extended documentation


    amitiuttarwar commented at 7:41 pm on August 17, 2020:
    done
  11. MarcoFalke approved
  12. MarcoFalke commented at 6:31 am on August 15, 2020: member
    Approach ACK, just some style-nits.
  13. in doc/release-notes.md:105 in 26baed4087 outdated
    101@@ -102,6 +102,22 @@ will trigger BIP 125 (replace-by-fee) opt-in. (#11413)
    102   option `-deprecatedrpc=banscore` is used. The `banscore` field will be fully
    103   removed in the next major release. (#19469)
    104 
    105+- The `getpeerinfo` RPC no longer returns the `inbound` or `addnode` fields by
    


    jonatack commented at 7:28 am on August 15, 2020:
    I think it’s premature to be deprecating these fields. It would be preferable to let the new code mature for a release or so and to implement how it might be presented in the GUI, before considering removing access to these via the RPC.

    MarcoFalke commented at 7:42 am on August 15, 2020:
    Agree that we don’t need to be overly aggressive with deprecation. If deprecation/removal is too controversial for now, it can be split up into another follow-up pull for later. I think adding the field should be uncontroversial and conceptually easier to get in.

    sipa commented at 7:47 am on August 15, 2020:
    I don’t think there is a reason to remove “inbound”, ever. It’s very useful to filter RPC output by on its own.

    amitiuttarwar commented at 7:49 pm on August 17, 2020:
    sounds good! I removed the “deprecate inbound” commit. I currently have left in the “deprecate getpeerinfo addnode” commit, but can also remove that one if reviewers would like. I do find the current way of calling it addnode (as is in master) misleading because it also returns -connect peers. But if having this information separately is desirable, I’m happy to remove that commit as well. I just don’t want the default to be the RPC bloating over time with redundant information.

    jonatack commented at 1:49 pm on August 24, 2020:

    makes two of the existing fields (inbound & addnode booleans) redundant

    sounds good! I removed the “deprecate inbound” commit. I currently have left in the “deprecate getpeerinfo addnode” commit, but can also remove that one if reviewers would like. I do find the current way of calling it addnode (as is in master) misleading because it also returns -connect peers. But if having this information separately is desirable, I’m happy to remove that commit as well.

    If addnode has different behavior, which users may depend on, is it redundant?

    (Edit: I apologize if I seem keen on addnode; I use both the rpc/cli/config option and the getpeerinfo field frequently)


    amitiuttarwar commented at 6:19 pm on August 24, 2020:

    it’s not different behavior. its the same.

    getpeerinfo field addnode returns a bool that indicates if the connection was manually added, either via addnode RPC or -connect command line argument.

    with this PR, getpeerinfo field connection_type will return manual for these connections.

    I’m saying that # 2 is more clear and accurate. I think your confusion around possible difference of behavior supports my point that it is unclear :)


    jonatack commented at 12:24 pm on August 25, 2020:
    Ok, I checked the code and indeed, (a) I misread you and (b) getpeerinfo addnode and conn_type manual are the same.
  14. jonatack commented at 8:24 am on August 15, 2020: member
    Concept ACK on adding the connection type to getpeerinfo and the logging.
  15. amitiuttarwar force-pushed on Aug 17, 2020
  16. amitiuttarwar commented at 7:51 pm on August 17, 2020: contributor
    thanks for the reviews! I’ve removed the “deprecate getpeerinfo inbound” commit & addressed all other review comments.
  17. in src/net.h:887 in c8a5626f7d outdated
    883@@ -874,6 +884,26 @@ class CNode
    884         assert(false);
    885     }
    886 
    887+    std::string ConnectionTypeToString() const
    


    laanwj commented at 1:13 pm on August 19, 2020:

    I’m not sure it’s better to have ConnectionTypeToString as a method on CNode instead of a free function that simply takes a ConnectionType.

    But if so, ConnectionTypeAsString might be a better name.

    Edit: Also, I’d prefer to move this function to the implementation file instead of the .h. Compact header files are better for readability, and there’s imo no performance reason to have this inlinable.


    amitiuttarwar commented at 6:55 pm on August 19, 2020:

    hm, I got a lot of review on #19316 expressing concerns around publicly exposing m_conn_type, which led to the current design of wrapper classes. since I need the return value in net_processing, I’ve opted to keep the function on CNode & updated the name to better reflect behavior, as per your suggestion. happy to reconsider if you still feel it would be better as a free function.

    also moved into net.cpp. I’m still trying to understand when inlining is worth it. so far my heuristic has mainly been “is this function computationally very simple”. but I hear your point of header files being readable. I’m interested in learning more if you have any other heuristics you consider / resources to share.

  18. in src/net.h:902 in c8a5626f7d outdated
    897+            return "outbound-full-relay";
    898+        case ConnectionType::BLOCK_RELAY:
    899+            return "block-relay-only";
    900+        case ConnectionType::ADDR_FETCH:
    901+            return "addr-fetch";
    902+        }
    


    laanwj commented at 1:15 pm on August 19, 2020:
    Please add // no default case, so the compiler can warn about missing cases comment (https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#c-data-structures)

    amitiuttarwar commented at 6:36 pm on August 19, 2020:
    ah thanks. done in this PR. I’ve also introduced other switches without default in #19316 & #19724. I will also add this comment to the others in #19724.

    amitiuttarwar commented at 3:43 am on August 21, 2020:
    added c99b26010eaf4d446eb5118e38dbcc03fabba11c in #19724
  19. amitiuttarwar force-pushed on Aug 19, 2020
  20. amitiuttarwar commented at 6:56 pm on August 19, 2020: contributor
    thanks for the review @laanwj. addressed all review comments
  21. in doc/release-notes.md:108 in 49a537170f outdated
    101@@ -102,6 +102,15 @@ will trigger BIP 125 (replace-by-fee) opt-in. (#11413)
    102   option `-deprecatedrpc=banscore` is used. The `banscore` field will be fully
    103   removed in the next major release. (#19469)
    104 
    105+- The `getpeerinfo` RPC no longer returns the `addnode` field by default. This
    106+  field will be fully removed in the next major release.  It can be accessed
    107+  with the configuration option `-deprecatedrpc=getpeerinfo_addnode`. However,
    108+  it is recommended to instead use the `connection_type` field.
    109+
    110+- The `getpeerinfo` RPC now returns a `connection_type` field. This indicates
    


    promag commented at 9:40 pm on August 19, 2020:

    I’d put this first.

    Side note, here and above, could add PR number? It’s a quick way to get context from the release notes.


    amitiuttarwar commented at 10:45 pm on August 19, 2020:
    ah thanks, forgot to update after actually opening the PR

    amitiuttarwar commented at 10:51 pm on August 19, 2020:
    done
  22. in doc/release-notes.md:108 in 49a537170f outdated
    101@@ -102,6 +102,15 @@ will trigger BIP 125 (replace-by-fee) opt-in. (#11413)
    102   option `-deprecatedrpc=banscore` is used. The `banscore` field will be fully
    103   removed in the next major release. (#19469)
    104 
    105+- The `getpeerinfo` RPC no longer returns the `addnode` field by default. This
    106+  field will be fully removed in the next major release.  It can be accessed
    107+  with the configuration option `-deprecatedrpc=getpeerinfo_addnode`. However,
    108+  it is recommended to instead use the `connection_type` field.
    


    promag commented at 9:49 pm on August 19, 2020:
    Could say that connection_type=manual when addnode=true.

    amitiuttarwar commented at 10:51 pm on August 19, 2020:
    done
  23. in src/net.h:656 in 49a537170f outdated
    652@@ -644,6 +653,7 @@ class CNodeStats
    653     // Bind address of our side of the connection
    654     CAddress addrBind;
    655     uint32_t m_mapped_as;
    656+    std::string m_connection_type;
    


    promag commented at 9:54 pm on August 19, 2020:
    Why string? What’s the problem of ConnectionType m_connection_type and a std::string ConnectionTypeToString(ConnectionType) function? Couldn’t find past discussion after a quick look.

    amitiuttarwar commented at 10:42 pm on August 19, 2020:

    do I understand your suggestion correctly: update CNodeStats.m_connection_type to the raw ConnectionType, then in getpeerinfo implementation, pass through a function ConnectionTypeToString(m_connection_type)?

    it’s possible, what’s the advantage?

    the main downside I’m seeing is I’m trying to keep m_connection_type private, and need to access it from net_processing for the log commit. so having ConnectionTypeAsString just return the std::string is more convenient.

    open to suggestions


    amitiuttarwar commented at 6:38 pm on August 24, 2020:
    resolving this convo for now, feel free to reopen/comment if you’d like me consider an alternative approach :)

    kallewoof commented at 3:45 am on August 26, 2020:

    I think string is fine, but I think the two variables are now a bit confusing. m_conn_type in CNode is a ConnectionType, and m_connection_type in CNodeStats is a string.

    My suggestion is to either

    1. Switch this to a ConnectionType, and maybe even use the same name; this unifies the two and no one has to ever wonder what the difference is between the m_conn_type and the m_connection_type.
    2. Rename this e.g. to m_conn_string.

    Feel free to ignore, though.


    laanwj commented at 12:26 pm on August 27, 2020:
    I would agree that storing a string here is a bit strange. This is a persistent structure in memory, and every string causes an extra heap allocation. Which means an extra heap allocation per connected node. While it stores only one from a limited number of choices, so as I understand, it could just as well be an enum?

    jnewbery commented at 6:27 pm on August 29, 2020:

    I’m not sure this is a problem:

    • in bitcoind, CNodeStats is just instantiated when needed, rather than kept persistently (it looks like the objects are cached in bitcoin-qt though)
    • most compilers will use the short string optimization, and most of these strings are < 15 chars long, so won’t result in a heap allocation
    • there are already 3 other std::string members in this struct

    amitiuttarwar commented at 6:04 am on September 4, 2020:
    • definitely agree that m_conn_string is a better variable name for the current state, have incorporated into the latest push
    • RE memory management- I’m not fully understanding how this is a persistent data structure. I tried to trace the call sites and I’m not seeing where its got anything other than automatic storage duration. But also don’t understand the gui caching. any pointers??
    • regardless, I’ve taken a shot at implementing having CNodeStats store a ConnectionType instead of a string. I haven’t incorporated into this patch yet, but happy to if this solution looks reasonable / preferable: https://github.com/amitiuttarwar/bitcoin/commit/93a56e2880ee2a1513447c1c8807ebfa70be9270. One thing is @laanwj you expressed here a preference for moving the function out of the header file, which this implementation undoes.

    I don’t have any strong preferences, happy with whatever reviewers prefer.

  24. promag commented at 10:09 pm on August 19, 2020: member
    Concept ACK.
  25. amitiuttarwar force-pushed on Aug 19, 2020
  26. in src/net.h:117 in f7f3ef4f09 outdated
    113@@ -114,6 +114,15 @@ struct CSerializedNetMsg
    114     std::string m_type;
    115 };
    116 
    117+const std::vector<std::string> CONNECTION_TYPE_DOC{
    


    jnewbery commented at 9:50 am on August 20, 2020:
    Is it possible to add an assert that the size of this vector is the same as the size of ConnectionType, so it’s not possible to update one without the other?

    amitiuttarwar commented at 2:00 am on August 21, 2020:
    I like the idea, but it looks like there’s no straightforward way to get the length of the enum? :(

    sipa commented at 3:13 am on August 21, 2020:

    I believe you can’t in general.

    But you can add a “MAX” element to the enum, which is the length.

    If you make the list an std::array instead of std::vector, you can make it a static_assert with that even.


    jnewbery commented at 10:33 am on August 21, 2020:

    @sipa what would you static assert on? When you declare the std_array type, you need to specify the length of the array, and the array is always going to be that size. eg this compiles:

     0enum class en {
     1    thing1,
     2    thing2,
     3    thing3,  // added a new thing
     4    MAX,
     5};
     6
     7int main()
     8{
     9    std::array<std::string, (int)en::MAX> a {"thing1 description", "thing2 description"}; // oops, didn't add a thing3 description. a[2] is default initialized to empty string
    10    static_assert(a.size() == (int)en::MAX); // always passes
    11    for (const auto& x : a) {
    12        std::cout << x << std::endl;
    13    }
    14}
    

    Would you replace the value in the static_assert with a hard-coded value?


    amitiuttarwar commented at 3:12 am on August 22, 2020:
    or maybe hardcode the length of the array?

    sipa commented at 3:45 am on August 22, 2020:
    @jnewbery Right, of course! I wasn’t considering that you could use MAX directly as array size. That’s obviously better.

    amitiuttarwar commented at 6:27 pm on August 24, 2020:

    I’m unclear on what’s being recommended here.

    Should I update to make CONNECTION_TYPE_DOC an array, allocate size based on MAX from enum, then hardcode the MAX value into the static assert to compare it to the size of array?


    MarcoFalke commented at 7:43 pm on August 24, 2020:

    Just in theory it would be possible to get the number of enum values via the preprocessor:

     0cat src/util/enum_class.h 
     1// Copyright (c) 2020 The Bitcoin Core developers
     2// Distributed under the MIT software license, see the accompanying
     3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
     4
     5#ifndef BITCOIN_UTIL_ENUM_CLASS_H
     6#define BITCOIN_UTIL_ENUM_CLASS_H
     7
     8#include <boost/preprocessor/variadic/size.hpp>
     9
    10#define ENUM_CLASS(name, ...)        \
    11    enum class name { __VA_ARGS__ }; \
    12    constexpr size_t name##_##SIZE { BOOST_PP_VARIADIC_SIZE(__VA_ARGS__) }
    13
    14#endif // BITCOIN_UTIL_ENUM_CLASS_H
    

    This could be used to write

    0static_assert(CONNECTION_TYPE_DOC.size() == ConnectionType_SIZE, "inconsistent docs");
    

    Probably not worth the effort. Just saying that it is possible.


    jnewbery commented at 12:35 pm on August 25, 2020:
    bah. Adding a MAX value breaks all the (important) “value not handled in switch statement” warnings. I don’t think this is worth it. Sorry for the noise!

    promag commented at 1:37 pm on September 23, 2020:

    @jnewbery this works, but also meh

     0enum class E {
     1  X,
     2  Y
     3  LAST = Y
     4};
     5
     6int f(E e) {
     7  switch (e) {
     8  case E::X: return 1;
     9  case E::Y: return 2;
    10  }
    11}
    

    jnewbery commented at 1:56 pm on September 23, 2020:

    also meh

    I agree!

  27. jnewbery commented at 9:55 am on August 20, 2020: member

    Tested ACK f7f3ef4f099d1f44b25c255baa0d25de448f3bdf

    One suggestion inline.

  28. DrahtBot commented at 8:22 pm on August 20, 2020: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #20002 (net, rpc, cli: expose GetNetClass()/ConnectedViaTor() in getpeerinfo, use in -netinfo by jonatack)
    • #19883 (net, rpc: expose connection type in getpeerinfo by jonatack)
    • #19877 ([test] clarify rpc_net & p2p_disconnect_ban functional tests by amitiuttarwar)
    • #19829 (net processing: Move block inventory state to net_processing by jnewbery)
    • #19776 (net, rpc: expose high bandwidth mode state via getpeerinfo by theStack)

    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.

  29. laanwj commented at 1:17 pm on August 24, 2020: member
    ACK f7f3ef4f099d1f44b25c255baa0d25de448f3bdf (code review, light manual testing on a busy node)
  30. jonatack commented at 1:34 pm on August 24, 2020: member

    It may be prudent to not aggressively deprecate the addnode field in the same release as the conn_type field addition, as this provides no transition period; users will need to change code or config to avoid breakage.

    Doing so also makes two of the existing fields (inbound & addnode booleans) redundant, so this PR begins deprecating those fields as well.

    Inbound isn’t being deprecated IIUC. Mind updating the PR description?

  31. amitiuttarwar commented at 6:36 pm on August 24, 2020: contributor

    @jonatack

    Inbound isn’t being deprecated IIUC. Mind updating the PR description?

    done, thanks!

    It may be prudent to not aggressively deprecate the addnode field in the same release as the conn_type field addition, as this provides no transition period; users will need to change code or config to avoid breakage.

    I don’t quite follow your logic. In this patch, users can support the old behavior with the configuration option -deprecatedrpc=getpeerinfo_addnode, as with any other time we deprecate a field. What is the difference between doing it in this version versus a future version?

    For the case of the inbound field, reviewers made a case that having the isolated boolean of connection direction is useful, so I removed the deprecation commit and left the field. I’m open to leaving the addnode field if there is a good reason. I believe it makes sense to remove because getpeerinfo is already huge, and I don’t want to bloat it with redundant information unless we have a specific reason to do so.

  32. MarcoFalke commented at 7:29 pm on August 24, 2020: member

    What is the difference between doing it in this version versus a future version?

    There is a slight difference in how urgent a user will need to update scripts. If there is one more version in-between the user can even upgrade without any -deprecatedrpc hassle.

    • release n: New feature added (user can upgrade Bitcoin core without using the new feature, see if there are any issues, if no issues after a month, they can start using the new feature)
    • release n+1: Old feature deprecated (user unaffected. If this was in release n, they’d either have to supply -deprecatedrpc or upgrade their script to use the new feature right away.)

    No strong opinion, just mentioning that there is a slight difference.

  33. amitiuttarwar commented at 8:17 pm on August 24, 2020: contributor

    okay fair, I hear the point about having a longer window of time during which to upgrade. that said, the minimum effort required to upgrade would still be the same.

    having a longer transition time makes sense for more complex features, but this is an extremely simple case and there’s not much that would benefit from being manually tested. we can hardly even call it a new feature: existing master: getpeerinfo#addnode returns a boolean based on stats.m_manual_connection which checks m_conn_type == ConnectionType::MANUAL proposed patch: getpeerinfo#connection_type returns manual if m_conn_type is ConnectionType::MANUAL based on a switch statement.

    what this means for the user is replacing any use of getpeerinfo.addnode with getpeerinfo.connection_type == "manual".

    I’m still not seeing what advantages a user would gain from having a ~6 month window to make this simple switch. on the flip side I see a downside of the maintenance burden of the code. We would either have to add a TODO in the code or remember to update in next version. based on these factors, I believe we should begin deprecating the getpeerinfo#addnode field with this PR unless we have a reason & want to leave it in for the long run (as with the inbound field).

  34. jonatack commented at 12:45 pm on August 25, 2020: member
    I think it’s generally been considered that for users there is a difference. Historically, Bitcoin Core has been very non-aggressive about deprecations and time periods, and users are used to that, as far I’ve been able to understand and from what I’ve seen from deprecating a few fields and the pushback from proposing to deprecate a few others: a few releases, at minimum. Examples: RPC getunconfirmedbalance (superceded a few releases ago by getbalances yet still not deprecated (and per reviewers, there is no rush to do so), or the getwalletinfo balance fields (idem). Stability for users seems to be generally seen as more important than the maintenance for us–which really might mean just making a draft PR with the relevant commit and tagging it for 0.22/0.23.
  35. jnewbery commented at 1:10 pm on August 25, 2020: member
    This is a very minor change to the RPC interface. I don’t think we need any special treatment for deprecating addnode. Lets just go through the normal deprecation process in this version and remove in the next.
  36. in doc/release-notes.md:110 in f7f3ef4f09 outdated
    101@@ -102,6 +102,17 @@ will trigger BIP 125 (replace-by-fee) opt-in. (#11413)
    102   option `-deprecatedrpc=banscore` is used. The `banscore` field will be fully
    103   removed in the next major release. (#19469)
    104 
    105+- The `getpeerinfo` RPC now returns a `connection_type` field. This indicates
    106+  the type of connection established with the peer. It will return one of six
    107+  options. For more information, see the `getpeerinfo` help documentation.
    


    kallewoof commented at 3:37 am on August 26, 2020:
    While these are release notes, I still think it’s worth it to at least list those 6 options to give a hint at what they are, even if describing each may be too verbose.

    jnewbery commented at 7:17 am on August 26, 2020:
    In general, I think we try to avoid duplicating documentation in this way. Release notes don’t need to include all the details, and pointing where to go for the source of truth is appropriate here.

    kallewoof commented at 7:25 am on August 26, 2020:

    Only reading the release notes you are left wanting, I suspect; explicitly saying there’s six of them makes you start to wonder “so many? I can think of maybe 3 at most… curious!”.

    Half-joke aside, simply “one of six options: a, b, c, d, e, or f” would be useful, but no strong opinion on the matter.


    laanwj commented at 12:21 pm on August 27, 2020:
    Agree with @jnewbery. Release notes should describe the change, briefly but clearly, they do not need to provide documentation on how to use something. I think this description is okay.

    amitiuttarwar commented at 6:05 am on September 4, 2020:
    ok, seems like the dominant reviewer preference is to leave as is? so, resolving this conversation
  37. in src/net.cpp:491 in f7f3ef4f09 outdated
    486@@ -487,6 +487,26 @@ void CConnman::AddWhitelistPermissionFlags(NetPermissionFlags& flags, const CNet
    487     }
    488 }
    489 
    490+std::string CNode::ConnectionTypeAsString() const
    


    kallewoof commented at 3:39 am on August 26, 2020:
    μNit, feel free to ignore: the As feels redundant. (I.e. ConnectionTypeString())

    laanwj commented at 12:22 pm on August 27, 2020:
    Nah, I propsed the current naming (it was already changed once). Lets not bikeshed it too much.

    jonatack commented at 8:32 am on September 5, 2020:
    ISTM this is a presentation concern, and could either be moved out to the RPC code or removed completely if it wasn’t needed for the RPC help, as API clients will in any case need to re-implement this logic.

    amitiuttarwar commented at 3:54 am on September 8, 2020:
    did you see the commit that introduced this function? (now https://github.com/bitcoin/bitcoin/pull/19725/commits/53059f9476b00f83a9f8161c5d03d857ce0cb164). It uses the string for logging in net_processing.cpp, so it wouldn’t make sense to move to the RPC code.

    jonatack commented at 9:25 am on September 8, 2020:
    I think it’s an unneeded abstraction.
  38. kallewoof commented at 3:46 am on August 26, 2020: member
    Concept ACK
  39. guggero approved
  40. guggero commented at 2:41 pm on August 29, 2020: contributor

    tACK

    Tested f7f3ef4f099d1f44b25c255baa0d25de448f3bdf locally on regtest.

    Was able to verify that the connection types inbound, manual, addr-fetch work as expected. The -deprecatedrpc=getpeerinfo_addnode flag also has the desired effect of adding the deprecated addnode back to the output of getpeerinfo.

  41. DrahtBot added the label Needs rebase on Sep 3, 2020
  42. amitiuttarwar force-pushed on Sep 4, 2020
  43. DrahtBot removed the label Needs rebase on Sep 4, 2020
  44. amitiuttarwar commented at 6:07 am on September 4, 2020: contributor

    Thank you for these reviews! 🙌🏽

    I had to rebase and I took the opportunity to change the variable name from CNodeStats.m_connection_type -> CNodeStats.m_conn_type_string

    Current status of this PR:

    • one open question here, all other comments addressed
    • Approach ACK from MarcoFalke, partial Concept ACK from jonatack , Concept ACK from promag and kallewoof
    • previous tip had tested ACK from jnewbery, code review & light manual testing ACK from laanwj, tACK from guggero
  45. amitiuttarwar commented at 7:46 am on September 4, 2020: contributor
    oops, looks like I have some test failures. will investigate / fix tomorrow.
  46. amitiuttarwar force-pushed on Sep 4, 2020
  47. amitiuttarwar commented at 10:26 pm on September 4, 2020: contributor
    tests fixed! ready for review.
  48. in src/net.h:121 in e0ca0ab023 outdated
    113@@ -114,6 +114,15 @@ struct CSerializedNetMsg
    114     std::string m_type;
    115 };
    116 
    117+const std::vector<std::string> CONNECTION_TYPE_DOC{
    118+    "outbound-full-relay (default automatic connections)",
    119+    "block-relay-only (does not relay transactions or addresses)",
    120+    "inbound (initiated by the peer)",
    121+    "manual (added via addnode RPC or -connect command line argument)",
    


    jonatack commented at 8:33 am on September 5, 2020:
    • addnode is also a configuration option

    • s/command line argument/configuration option/


    amitiuttarwar commented at 3:52 am on September 8, 2020:
    done, thanks!
  49. in src/net.h:123 in e0ca0ab023 outdated
    118+    "outbound-full-relay (default automatic connections)",
    119+    "block-relay-only (does not relay transactions or addresses)",
    120+    "inbound (initiated by the peer)",
    121+    "manual (added via addnode RPC or -connect command line argument)",
    122+    "addr-fetch (short lived automatic connection for soliciting addresses)",
    123+    "feeler (short lived automatic connection for testing addresses)"
    


    jonatack commented at 8:35 am on September 5, 2020:
    s/short lived/short-lived/ in this line and the preceding one

    amitiuttarwar commented at 3:52 am on September 8, 2020:
    done
  50. in src/rpc/net.cpp:236 in e0ca0ab023 outdated
    232@@ -228,6 +233,7 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
    233                 recvPerMsgCmd.pushKV(i.first, i.second);
    234         }
    235         obj.pushKV("bytesrecv_per_msg", recvPerMsgCmd);
    236+        obj.pushKV("connection_type", stats.m_conn_type_string);
    


    jonatack commented at 8:42 am on September 5, 2020:
    Would suggest placing it on the line immediately after addnode.

    amitiuttarwar commented at 4:05 am on September 8, 2020:

    agreed on placing after addnode, updated in latest push. thanks!

    having an integer value seems like a reasonable proposal, I’ll leave it for review via 19883.

  51. jonatack commented at 3:36 pm on September 5, 2020: member
    Suggestions and feedback below. In some ways they differ a lot from the approach here, so I’ve proposed an alternative in #19883.
  52. in test/functional/rpc_getpeerinfo_deprecation.py:34 in e0ca0ab023 outdated
    29+        connect_nodes(self.nodes[0], 1)
    30+
    31+        self.log.info("Test getpeerinfo by default no longer returns an addnode field")
    32+        assert "addnode" not in self.nodes[0].getpeerinfo()[0].keys()
    33+
    34+        self.log.info("Test getpeerinfo returns inbound with -deprecatedrpc=addnode")
    


    jnewbery commented at 9:54 am on September 7, 2020:
    s/inbound/addnode/

    amitiuttarwar commented at 4:06 am on September 8, 2020:
    oops. fixed, thanks!
  53. jnewbery commented at 9:56 am on September 7, 2020: member

    utACK e0ca0ab023

    Log in test is incorrect and should be fixed.

    I prefer this PR to the approach in #19883.

  54. amitiuttarwar force-pushed on Sep 8, 2020
  55. amitiuttarwar commented at 4:10 am on September 8, 2020: contributor

    thanks for the reviews @jonatack & @jnewbery !

    I’ve pushed another round that addresses the outstanding comments.

  56. jnewbery commented at 11:26 am on September 8, 2020: member
    utACK 2499b120cca63a5c13ea6e782d8ff53caae5d3dd @jonatack - how do you feel about having a string and a type number for connection type returned by getpeerinfo(). I personally wouldn’t use it but I could see how it’d be useful for a client application. No reason not to return both I think.
  57. jonatack commented at 12:01 pm on September 8, 2020: member

    jonatack - how do you feel about having a string and a type number for connection type returned by getpeerinfo(). I personally wouldn’t use it but I could see how it’d be useful for a client application. No reason not to return both I think.

    Indeed, the first version of #19883 proposed both an integer id and the long-format string id, before removing the string after the first round of review to take advantage of the improvement that brings in performance, maintenance, code, complexity, memory, bandwidth, etc.

    I’ve been dogfooding the conn type for the -netinfo dashboard and prefer to parse integer ids for the reasons described in #19883 (comment).

    Client-side, you can bounds check an integer and then use it to call a data structure element. No need to match against each of the possible long format string values to error check it.

  58. amitiuttarwar commented at 10:55 pm on September 9, 2020: contributor

    okay @jonatack, I think you have made your stance sufficiently clear :)

    for other reviewers- I believe these proposed changes make sense. The logging & RPC exposure were proposed by @sdaftuar during review of 19316 & I agree with them. As a node operator, I would like to be able to easily see information about the connection types to peers, through the RPC interface and logs. As a code contributor I like cleaning up along the way so our codebase complexity doesn’t just grow over time.

    the PR is in a ready-for-review state. tip currently has 1 utACK from @jnewbery (thanks!)

    several other reviewers have expressed support of these changes from different levels of ACKs, am curious to hear if they still think the patch makes sense.

    thanks!

  59. guggero commented at 1:39 pm on September 17, 2020: contributor

    tACK 2499b120.

    I personally also prefer this PR over #19883.

    Numeric types still requires your code to do a lookup of some sort to present a human-readable value. If the meaning of a numeric value changes, you cannot catch this easily. Assuming that a string based enum value would be renamed if its meaning changed, a user of the API would notice that with a higher probability IMO.

  60. jonatack commented at 2:04 pm on September 17, 2020: member

    When considering replacing integer ids with long-format string ids for API clients, remember that the long-format naming is:

    • (a) in flux (e.g., some people write “block-relay”, others “block-relay-only”, some now write “b-r-o”, etc.)
    • (b) will change as new and additional types are conceived
    • (c) the GUI, CLI -netinfo, and client software will all have to translate the naming anyway for their human-facing needs and display constraints

    Consider why we use integers for BIP numbers. Once one is assigned, it can be stable, for it is decoupled from the changing naming and fashion of the day.

    I wouldn’t be surprised if within a year we refer to conn_types by number.

    The same observation goes for enum Network / CNetAddr::GetNetClass, another enum we’ll need to have getpeerinfo expose in order to reliably know whether a peer is ipv4, ipv6, onion, i2p, cjdns, etc.

    I suggest that we may as well begin with integer ids from the start and be done with it.

  61. jonatack commented at 2:11 pm on September 17, 2020: member

    your code to do a lookup of some sort to present a human-readable value

    Yes, that is what client-side software does: presentation. I suggest that there’s no need to burden the net code with client-side presentation concerns that can go in /rpc or be left to the API clients that consume the API.

  62. guggero commented at 3:04 pm on September 17, 2020: contributor

    I don’t disagree with your arguments. Naming is hard and choosing the same representation for the same thing everywhere is not always easy.

    Though as someone that’s almost exclusively using the command line, I like getting a (rough) idea what a value means without needing a lookup table. But likely I’m not the target user group this API was designed for so maybe my opinion is a bit skewed and should be weighted accordingly.

    I however would not object to adding a numeric type in addition to the string value.

  63. jonatack commented at 3:16 pm on September 17, 2020: member
    Same, almost exclusively use the command line too. I hope we can have the uint8_t ids but if people want this then ACK from me.
  64. practicalswift commented at 4:02 pm on September 17, 2020: contributor

    Concept ACK on returning a meaningful but terse string representation (inbound, manual, feeler, etc.) instead of leaking implementation details (0, 1, 2, etc.). (What happens when the enum values are re-arranged?)

    Empirical study: I’ve used the -netinfo feature a lot recently but the magic numbers are driving me crazy. I’ve lost count on how many times I’ve asked myself: “was it bitcoin-cli -netinfo 3 or bitcoin-cli -netinfo 4 that corresponds to the layout I like?” :)

    I don’t know of any precedent of that style in Unix land TBH.

  65. jonatack commented at 4:29 pm on September 17, 2020: member
  66. michaelfolkson commented at 4:58 pm on September 17, 2020: contributor

    I’d personally feel more comfortable if more people weighed in on Jon’s comment in the alternative PR.

    By any objective technical criteria, ersatz long-format string ids in the place of integer ones seem a substantially worse choice

    code complexity robustness API stability API flexibility for clients memory speed network bandwidth maintainability in every way maybe an order of magnitude worse.

    JSON-RPC expects integer ids.

    An API client can bounds check an integer id, then call a vector element with it.

    With a long format string, the client has to match against every possible expected value first in order to error check the value.

    I have no strong opposition to bundling changes into a PR but I would like to check whether people (especially experienced reviewers) agree, disagree, or are indifferent to Jon’s above comment.

  67. practicalswift commented at 5:31 am on September 18, 2020: contributor

    Concept ACK on returning a meaningful but terse string representation (inbound, manual, feeler, etc.) instead of leaking implementation details (0, 1, 2, etc.). (What happens when the enum values are re-arranged?)

    @practicalswift: #19883 (comment)

    Thanks for clarifying regarding re-arrangement.

    Do you know of any precedent of this style in Unix land, or in Bitcoin Core?

  68. DrahtBot added the label Needs rebase on Sep 19, 2020
  69. MarcoFalke commented at 7:55 am on September 19, 2020: member
    Concept ACK. Seems fine to return the type as a human readable string that can also be logged. If the strings ever need to change and a client needs a stable interface, e.g. to collect statistics on connection types, then a separate PR could add integral ids at that time (or earlier, when needed).
  70. [log] Add connection type to log statement
    In addition to adding more specificity to the log statement about the type of
    connection, this change also consolidates two statements into one. Previously,
    the second one should have never been hit, since block-relay connections would
    match the "!IsInboundConn()" condition and return early.
    49c10a9ca4
  71. [rpc] Add connection type to getpeerinfo RPC, update tests 395acfa83a
  72. [refactor] Rename test file to allow any getpeerinfo deprecations.
    Simple rename/restructure to allow for upcoming test additions.
    df091b9b50
  73. [rpc] Deprecate getpeerinfo addnode field
    This field is now redundant since the connection type field will indicate
    MANUAL for addnode connections.
    50f94b34a3
  74. [doc] Release notes a512925e19
  75. amitiuttarwar force-pushed on Sep 22, 2020
  76. amitiuttarwar commented at 3:25 am on September 22, 2020: contributor

    many many thanks for the code reviews @jnewbery & @guggero! I’m very sorry but could I ask for a 3rd round? I had to rebase because of a very trivial conflict in the release notes 😬 but hopefully that means its easy to re-review.

    and thank you for your recent Concept ACKs @MarcoFalke & @practicalswift!

    if these changes are supported, I’d love to get them in relatively soon. the proposed patch has been pretty stable recently and it’d be great if I didn’t have to ask for a 4th round of review because of rebases 😅 . Also, I’m working on enabling testing of additional connection types in #19315, and this patch would enable me to check the specific connection types (outbound full relay vs block relay only) rather than just checking they are not inbound connections (link).

    I standby my view that these changes are not in conflict with #19883- the getpeerinfo fields services and servicesnames is an example of where we return separate values for machines vs humans.

  77. DrahtBot removed the label Needs rebase on Sep 22, 2020
  78. michaelfolkson commented at 12:05 pm on September 23, 2020: contributor

    Approach NACK. I prefer the approach in #19883 (comment). I certainly don’t think we should rush through merges either whilst there is still discussion on an alternative approach happening (especially when the author of the alternative approach has ideas on where he’d like to take it downstream).

    I think the logging refactoring and deprecation are fine.

    edit: Perhaps we could hammer out this out in a Bitcoin Core PR review club session. I don’t want to hold up progress but I also want to make sure we get this right and future plans aren’t disrupted.

  79. jnewbery commented at 12:29 pm on September 23, 2020: member

    Code review ACK a512925e19a70d7f6b80ac530a169f45ffaafa1c.

    I certainly don’t think we should rush through merges

    For goodness’ sake. This PR has been open for over a month and has ACKs from:

    There are also comments supporting a string representation of connection type in #19883:

    To say that this PR is being rushed is a total mischaracterization. In fact, the converse is true - this PR has widespread support from the vast majority of regular contributors, and a huge amount of maintainer/contributor time have been wasted on a minor PR.

    To repeat what has been stated clearly many times before: there doesn’t have to be a conflict between this and #19883 and each should be judged on its own merits.

  80. michaelfolkson commented at 12:41 pm on September 23, 2020: contributor

    This is a conflict though right? What do you recommend? ACK this PR and then open a new PR changing the connection type to an int? There is a difference between throwing toys out of the pram because you don’t get everything you want versus wanting to ensure a decision now doesn’t disrupt future work.

    As far as I understand Concept ACKs don’t cover this discussion whatsoever so including them seems misleading.

  81. promag commented at 1:52 pm on September 23, 2020: member

    Code review ACK a512925e19a70d7f6b80ac530a169f45ffaafa1c.

    Could already ditch m_manual_connection and update copyStats accordingly. Can be done in 0.22 when addnode is removed.

    open a new PR changing the connection type to an int

    IMO that’s fine, I also support that, but for the RPC client this change is good enough.

    As far as I understand Concept ACKs don’t cover this discussion whatsoever so including them seems misleading.

    Right, but it ins’t an approach NACK so it counts a bit.

  82. sdaftuar commented at 2:14 pm on September 23, 2020: member

    Concept ACK putting in human readable connection types in this RPC. I personally use getpeerinfo() quite a bit while debugging, and not having to (eg) infer whether a peer is a block-relay-only outbound by using the inbound and relaytxes variables, and being able to grep for a human readable string, would save me time.

    Not a major concern, but I do think it’s worth thinking a bit about how stable the API is here. For example, one thing I’m working on is a way to negotiate block-relay-only status on a connection, so that both the inbound and outbound side of the connection are aware of how the connection is being treated. That might mean that the strings we choose to use here could change as we try to improve the documentation to reflect new behavior in the code. So if users are expecting the RPC output to be a stable API, I’m not sure we’re there yet. Perhaps that would be something for us to mention in the release notes the first time this appears?

  83. amitiuttarwar commented at 9:26 pm on September 25, 2020: contributor

    thank you for the reviews @jnewbery, @promag, @sdaftuar ! @sdaftuar

    So if users are expecting the RPC output to be a stable API, I’m not sure we’re there yet. Perhaps that would be something for us to mention in the release notes the first time this appears?

    good idea. In the interest of preserving ACKs I’ve added https://github.com/amitiuttarwar/bitcoin/commit/099e38724adb2c002f0b9ec4271f9247067844d6 on another branch. I’ll either incorporate here or can do in a follow-up. @michaelfolkson

    Approach NACK. I prefer the approach in #19883 (comment).

    can you please provide the rationale for your NACK? as I stated in #19725 (comment) (and others have also expressed)

    I standby my view that these changes are not in conflict with #19883- the getpeerinfo fields services and servicesnames is an example of where we return separate values for machines vs humans.

    if you disagree and think the two conflict, please provide the reasoning to help me understand the dissonance. thanks!

  84. sipa commented at 1:36 am on September 26, 2020: member

    I don’t think this is a good argument for numbers:

    When considering replacing integer ids with long-format string ids for API clients, remember that the long-format naming is:

    (a) in flux (e.g., some people write “block-relay”, others “block-relay-only”, some now write “b-r-o”, etc.)

    I don’t think this is true. It is the actual semantics of different connection types that change sometimes, and not just their names. For example, if a particular connection type that currently exists is split into two different types, the old type ceases to exist, and what its number in the enum refers to afterwards will generally be arbitrary. If the semantics change, we’d want the name to change as well, to provide a consistent interface.

    (b) will change as new and additional types are conceived

    If the meaning changes, why would the reported names not change? That even seems desirable. We can’t promise to restrict the potential output in RPC of this to any particular set of strings (or numbers, for that matter). That would be like promising in the getblockchaininfo RPC that the "type" field can only ever be "buried" or "bip9", and then coming to the painful observation that this means we’re unable to adopt new activation mechanisms…

    (c) the GUI, CLI -netinfo, and client software will all have to translate the naming anyway for their human-facing needs and > display constraints

    Agree, but I don’t think this is any worse or better for numbers vs names.

    Consider why we use integers for BIP numbers. Once one is assigned, it can be stable, for it is decoupled from the changing naming and fashion of the day.

    That’s because we need a long-term way of referring to an idea. I don’t think that’s the case here, as the semantics of what types of connections exist is in flux, as you say.

    A correct analogy would be assigning numbers to the connection types (distinct from the internal enum), and any time the way the policy decisions around various connection types change, pick a new number and retire the old one. I don’t think that’s preferable to just understandable names that do the same thing.

  85. sipa commented at 1:41 am on September 26, 2020: member
    utACK a512925e19a70d7f6b80ac530a169f45ffaafa1c
  86. guggero commented at 8:29 am on September 26, 2020: contributor
    Tested and code review ACK a512925e.
  87. MarcoFalke commented at 3:24 pm on September 26, 2020: member

    cr ACK a512925e19a70d7f6b80ac530a169f45ffaafa1c 🌇

    Signature:

     0-----BEGIN PGP SIGNED MESSAGE-----
     1Hash: SHA512
     2
     3cr ACK a512925e19a70d7f6b80ac530a169f45ffaafa1c 🌇
     4-----BEGIN PGP SIGNATURE-----
     5
     6iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
     7pUjoEQv/dMdhuBqd2oAqHggaa2Yb972bRNVWlue2JmORCDOpmItlSBjiwo5hcJyV
     8W4ZcGG732EVI/jZDbr2oa7QfYOCcR8JVWVqNJLz637l6R1SbquwXl39uuMdgp03Q
     9LYutCkf361QIIzHfVy4ayGjjNH9UVeGVmh+u0vBx8kWivTzxF0mlFcilc6vaVFnp
    10luviz3qJN/TtuSkvWYtIPJ6mqRxJLMkIRfRFl43puzXLojKipJI7vHQHAO07BFj/
    11W25yCxGBIJ9lMxofAgJS3fNQQ9YwbVw+CsHInR8fvuAOjLTkSEmEsKk97yvVqvrF
    12Ok7Nw67CyxRJ4b7NF7E6tu10iJDnirwbqkEiz/a7apIq7/V+SRYzTFXy/BMUcOx4
    13ZYzUUgc1hOYXcgaIf+ormDmuar+JXFGEIFRxugNMgrz2nKZD++kgg+/22kue/gkf
    14WEdi7ZPwfu23HXPKectDeNldcWlZFofGvdfoNMbTpeRnJuisS6tys6bkNrKLOfiw
    15H0WlvBpz
    16=rQUg
    17-----END PGP SIGNATURE-----
    

    Timestamp of file with hash e3ad231c501be41233b2be1a9001e466947870576a8514e0d67035a2f2a5e785 -

  88. MarcoFalke merged this on Sep 26, 2020
  89. MarcoFalke closed this on Sep 26, 2020

  90. in src/net.h:123 in a512925e19
    118+    "outbound-full-relay (default automatic connections)",
    119+    "block-relay-only (does not relay transactions or addresses)",
    120+    "inbound (initiated by the peer)",
    121+    "manual (added via addnode RPC or -addnode/-connect configuration options)",
    122+    "addr-fetch (short-lived automatic connection for soliciting addresses)",
    123+    "feeler (short-lived automatic connection for testing addresses)"};
    


    MarcoFalke commented at 3:33 pm on September 26, 2020:

    I think for “heavy objects” (non integral), we use extern const in the header and put them in the c++ file. This might reduce the size of the binary minimally.

    So if you need to touch this code in the future again, you could apply the following diff (or similar):

     0diff --git a/src/net.cpp b/src/net.cpp
     1index 5b533d7d17..166fc8233d 100644
     2--- a/src/net.cpp
     3+++ b/src/net.cpp
     4@@ -488,6 +488,15 @@ void CConnman::AddWhitelistPermissionFlags(NetPermissionFlags& flags, const CNet
     5     }
     6 }
     7 
     8+extern const std::vector<std::string> CONNECTION_TYPE_DOC{
     9+    "outbound-full-relay (default automatic connections)",
    10+    "block-relay-only (does not relay transactions or addresses)",
    11+    "inbound (initiated by the peer)",
    12+    "manual (added via addnode RPC or -addnode/-connect configuration options)",
    13+    "addr-fetch (short-lived automatic connection for soliciting addresses)",
    14+    "feeler (short-lived automatic connection for testing addresses)",
    15+};
    16+
    17 std::string CNode::ConnectionTypeAsString() const
    18 {
    19     switch (m_conn_type) {
    20diff --git a/src/net.h b/src/net.h
    21index 5a8e57b68b..3c6c45c161 100644
    22--- a/src/net.h
    23+++ b/src/net.h
    24@@ -114,13 +114,7 @@ struct CSerializedNetMsg
    25     std::string m_type;
    26 };
    27 
    28-const std::vector<std::string> CONNECTION_TYPE_DOC{
    29-    "outbound-full-relay (default automatic connections)",
    30-    "block-relay-only (does not relay transactions or addresses)",
    31-    "inbound (initiated by the peer)",
    32-    "manual (added via addnode RPC or -addnode/-connect configuration options)",
    33-    "addr-fetch (short-lived automatic connection for soliciting addresses)",
    34-    "feeler (short-lived automatic connection for testing addresses)"};
    35+extern const std::vector<std::string> CONNECTION_TYPE_DOC;
    36 
    37 /** Different types of connections to a peer. This enum encapsulates the
    38  * information we have available at the time of opening or accepting the
    

    MarcoFalke commented at 3:46 pm on September 26, 2020:

    Just tested locally, and the size does decrease by about 10kB:

    0--- a/tmp/old/d_size
    1+++ b/tmp/new/d_size
    2@@ -1 +1 @@
    3-10044320
    4+10027432
    

    amitiuttarwar commented at 8:53 pm on October 5, 2020:
    cool! I made a follow up to clarify expectations around stability in release notes, so I included this improvement too. didn’t realize about this extern trick, thanks! https://github.com/bitcoin/bitcoin/pull/20090
  91. sidhujag referenced this in commit e1572349ed on Sep 26, 2020
  92. laanwj referenced this in commit 9ad7cd2887 on Oct 15, 2020
  93. sidhujag referenced this in commit 50f8aee5b4 on Oct 16, 2020
  94. laanwj referenced this in commit db26eeba71 on Oct 28, 2020
  95. sidhujag referenced this in commit 121e9b9581 on Oct 28, 2020
  96. Fabcien referenced this in commit 441b4bbc73 on Oct 28, 2021
  97. Fabcien referenced this in commit 2df9a7a6b5 on Oct 28, 2021
  98. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-01 10:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me