Commit graph

670 commits

Author SHA1 Message Date
MarcoFalke
384e090f93
Merge #19509: Per-Peer Message Capture
bff7c66e67 Add documentation to contrib folder (Troy Giorshev)
381f77be85 Add Message Capture Test (Troy Giorshev)
e4f378a505 Add capture parser (Troy Giorshev)
4d1a582549 Call CaptureMessage at appropriate locations (Troy Giorshev)
f2a77ff97b Add CaptureMessage (Troy Giorshev)
dbf779d5de Clean PushMessage and ProcessMessages (Troy Giorshev)

Pull request description:

  This PR introduces per-peer message capture into Bitcoin Core.  📓

  ## Purpose

  The purpose and scope of this feature is intentionally limited.  It answers a question anyone new to Bitcoin's P2P protocol has had: "Can I see what messages my node is sending and receiving?".

  ## Functionality

  When a new debug-only command line argument `capturemessages` is set, any message that the node receives or sends is captured.  The capture occurs in the MessageHandler thread.  When receiving a message, it is captured as soon as the MessageHandler thread takes the message off of the vProcessMsg queue.  When sending, the message is captured just before the message is pushed onto the vSendMsg queue.

  The message capture is as minimal as possible to reduce the performance impact on the node.  Messages are captured to a new `message_capture` folder in the datadir.  Each node has their own subfolder named with their IP address and port.  Inside, received and sent messages are captured into two binary files, msgs_recv.dat and msgs_sent.dat, like so:

  ```
  message_capture/203.0.113.7:56072/msgs_recv.dat
  message_capture/203.0.113.7:56072/msgs_sent.dat
  ```

  Because the messages are raw binary dumps, included in this PR is a Python parsing tool to convert the binary files into human-readable JSON.  This script has been placed on its own and out of the way in the new `contrib/message-capture` folder.  Its usage is simple and easily discovered by the autogenerated `-h` option.

  ## Future Maintenance

  I sympathize greatly with anyone who says "the best code is no code".

  The future maintenance of this feature will be minimal.  The logic to deserialize the payload of the p2p messages exists in our testing framework.  As long as our testing framework works, so will this tool.

  Additionally, I hope that the simplicity of this tool will mean that it gets used frequently, so that problems will be discovered and solved when they are small.

  ## FAQ

  "Why not just use Wireshark"

  Yes, Wireshark has the ability to filter and decode Bitcoin messages.  However, the purpose of the message capture added in this PR is to assist with debugging, primarily for new developers looking to improve their knowledge of the Bitcoin Protocol.  This drives the design in a different direction than Wireshark, in two different ways.  First, this tool must be convenient and simple to use.  Using an external tool, like Wireshark, requires setup and interpretation of the results.  To a new user who doesn't necessarily know what to expect, this is unnecessary difficulty.  This tool, on the other hand, "just works".  Turn on the command line flag, run your node, run the script, read the JSON.  Second, because this tool is being used for debugging, we want it to be as close to the true behavior of the node as possible.  A lot can happen in the SocketHandler thread that would be missed by Wireshark.

  Additionally, if we are to use Wireshark, we are at the mercy of whoever it maintaining the protocol in Wireshark, both as to it being accurate and recent.  As can be seen by the **many** previous attempts to include Bitcoin in Wireshark (google "bitcoin dissector") this is easier said than done.

  Lastly, I truly believe that this tool will be used significantly more by being included in the codebase.  It's just that much more discoverable.

ACKs for top commit:
  MarcoFalke:
    re-ACK bff7c66e67 only some minor changes: 👚
  jnewbery:
    utACK bff7c66e67
  theStack:
    re-ACK bff7c66e67

Tree-SHA512: e59e3160422269221f70f98720b47842775781c247c064071d546c24fa7a35a0e5534e8baa4b4591a750d7eb16de6b4ecf54cbee6d193b261f4f104e28c15f47
2021-02-02 13:11:28 +01:00
Wladimir J. van der Laan
d1ddead09a
Merge #180: Peer details: connection type follow-ups
79a2576af1 doc: update ConnectionType Doxygen documentation (Jon Atack)
f3153dc08f gui: improve markup handling of connection type tooltip (Jon Atack)
4f09615733 gui: return inbound {full, block} relay type in peer details (Jon Atack)

Pull request description:

  Three follow-ups to #163:
  - return relay type for inbound peers
  - improve markup handling in the tooltip to facilitate translations
  - update ConnectionType doxygen documentation

  ![Screenshot from 2021-01-11 08-37-44](https://user-images.githubusercontent.com/2415484/104156081-50e69300-53e0-11eb-9b0f-880cb5626d68.png)

ACKs for top commit:
  hebasto:
    re-ACK 79a2576af1, only suggested changes since my [previous](https://github.com/bitcoin-core/gui/pull/180#pullrequestreview-564894781) review.
  jarolrod:
    ACK 79a2576af1, tested on macOS 11.1 with Qt 5.15.2
  laanwj:
    Code review ACK 79a2576af1

Tree-SHA512: 4a8d8f8bfbaefd68e8d1bf3b20d29e4a8e8cfe97b2f8d59d3a4c338a50b61de0a67d97bd8646c04bd5df5a9679c4954b9b46e7cba24bb89f4d0e44e94cf9d66c
2021-01-27 20:33:52 +01:00
Troy Giorshev
f2a77ff97b Add CaptureMessage
This commit adds the CaptureMessage function.  This will later be called
when any message is sent or received.  The capture directory is fixed,
in a new folder "message_capture" in the datadir.  Peers will then have
their own subfolders, named with their IP address and port, replacing
colons with underscores to keep compatibility with Windows.  Inside,
received and sent messages will be captured into two binary files,
msgs_recv.dat and msgs_sent.dat.

e.g.
message_capture/203.0.113.7_56072/msgs_recv.dat
message_capture/203.0.113.7_56072/msgs_sent.dat

The format has been designed as to result in a minimal performance
impact.  A parsing script is added in a later commit.
2021-01-23 15:58:42 -05:00
John Newbery
bf100f8170 [net] Cleanup InactivityChecks() and add commenting about time
Also clean up and better comment the function. InactivityChecks() uses a
mixture of (non-mockable) system time and mockable time. Make sure
that's well documented.

Despite being marked as const in CConnman before this commit, the
function did mutate the state of the passed in CNode, which is contained
in vNodes, which is a member of CConnman. To make the function truly
const in CConnman and all its data, instead make InactivityChecks() a
pure function, return whether the peer should be disconnected, and let
the calling function (SocketHandler()) update the CNode object. Also
make the CNode& argument const.
2021-01-19 10:50:36 +00:00
John Newbery
06fa85cd50 [net] InactivityCheck() takes a CNode reference 2021-01-13 16:18:12 +00:00
Wladimir J. van der Laan
60427ee35f
Merge #20811: refactor: move net_processing implementation details out of header
c97f70c861 net_processing: move Peer definition to .cpp (Anthony Towns)
e0f2e6d2df net_processing: move PeerManagerImpl into cpp file (Anthony Towns)
a568b82feb net_processing: split PeerManager into interface and implementation classes (Anthony Towns)
0df3d3fd6b net_processing: make more of PeerManager private (Anthony Towns)
0d246a59b6 net, net_processing: move NetEventsInterface method docs to net.h (Anthony Towns)

Pull request description:

  Moves the implementation details of `PeerManager` and all of `struct Peer` into net_processing.cpp.

ACKs for top commit:
  jnewbery:
    ACK c97f70c861
  Sjors:
    ACK c97f70c861
  laanwj:
    Code review ACK c97f70c861
  vasild:
    ACK c97f70c861

Tree-SHA512: 2e081e491d981c61bd78436a6a6c2eb41d3c2d86a1a8ef9d4d6f801b82cb64a8bf707a96db3429418d1704cffb60a657d1037a0336cbc8173fb79aef9eb72001
2021-01-13 09:48:06 +01:00
MarcoFalke
6af013792f
Merge #19315: [tests] Allow outbound & block-relay-only connections in functional tests.
b4dd2ef800 [test] Test the add_outbound_p2p_connection functionality (Amiti Uttarwar)
602e69e427 [test] P2PBlocksOnly - Test block-relay-only connections. (Amiti Uttarwar)
8bb6beacb1 [test/refactor] P2PBlocksOnly - Extract transaction violation test into helper. (Amiti Uttarwar)
99791e7560 [test/refactor] P2PBlocksOnly - simplify transaction creation using blocktool helper. (Amiti Uttarwar)
3997ab9154 [test] Add test framework support to create outbound connections. (Amiti Uttarwar)
5bc04e8837 [rpc/net] Introduce addconnection to test outbounds & blockrelay (Amiti Uttarwar)

Pull request description:

  The existing functional test framework uses the `addnode` RPC to spin up manual connections between bitcoind nodes. This limits our ability to add integration tests for our networking code, which often executes different code paths for different connection types.

  **This PR enables creating `outbound` & `block-relay-only` P2P connections in the functional tests.** This allows us to increase our p2p test coverage, since we can now verify expectations around these connection types.

  This builds out the [prototype](https://github.com/bitcoin/bitcoin/issues/14210#issuecomment-527421978) proposed by ajtowns in #14210. 🙌🏽

  An overview of this branch:
  - introduces a new test-only RPC function `addconnection` which initiates opening an `outbound` or `block-relay-only` connection. (conceptually similar to `addnode` but for different connection types & restricted to regtest)
  - adds `test_framework` support so a mininode can open an `outbound`/`block-relay-only` connection to a `P2PInterface`/`P2PConnection`.
  - updates `p2p_blocksonly` tests to create a `block-relay-only` connection & verify expectations around transaction relay.
  - introduces `p2p_add_connections` test that checks the behaviors of the newly introduced `add_outbound_p2p_connection` test framework function.

  With these changes, there are many more behaviors that we can add integration tests for. The blocksonly updates is just one example.

  Huge props to ajtowns for conceiving the approach & providing me feedback as I've built out this branch. Also thank you to jnewbery for lots of thoughtful input along the way.

ACKs for top commit:
  troygiorshev:
    reACK b4dd2ef800
  jnewbery:
    utACK b4dd2ef800
  MarcoFalke:
    Approach ACK b4dd2ef800 🍢

Tree-SHA512: d1cba768c19c9c80e6a38b1c340cc86a90701b14772c4a0791c458f9097f6a4574b4a4acc7d13d6790c7b1f1f197e2c3d87996270f177402145f084ef8519a6b
2021-01-11 21:06:57 +01:00
MarcoFalke
5cce607105
Merge #20373: refactor, net: Increase CNode data member encapsulation
3642b2ed34 refactor, net: Increase CNode data member encapsulation (Hennadii Stepanov)
acebb79d3f refactor, move-only: Relocate CNode private members (Hennadii Stepanov)

Pull request description:

  All protected `CNode` data members could be private.

ACKs for top commit:
  jnewbery:
    utACK 3642b2ed34
  MarcoFalke:
    review ACK 3642b2ed34 🏛

Tree-SHA512: 8435e3c43c3b7a3107d58cb809b8b5e1a1c0068677e249bdf0fc6ed24140ac4fc4efe2a280a1ee86df180d738c0c9e10772308690607954db6713000cf6e728d
2021-01-11 13:19:43 +01:00
fanquake
c4458cc3a1
Merge #18819: net: Replace cs_feeFilter with simple std::atomic
fad1f0fd33 net: Remove unused cs_feeFilter (MarcoFalke)

Pull request description:

  A `RecursiveMutex` is overkill for setting or reading a plain integer. Even a `Mutex` is overkill, when a plain `std::atomic` can be used.

  This removes 11 lines of code. Also, it is cutting down on the number of locks put on the stack at the same time, which complicates review looking out for potential lock contention.

ACKs for top commit:
  jnewbery:
    utACK fad1f0fd33
  practicalswift:
    cr ACK fad1f0fd33: patch looks correct

Tree-SHA512: 647f9b954fbf52e138d3e710937eb9131b390fef0deae03fd6a162d5a18b9f194010800bbddc8f89208d91be2802dff11c3884d04b3dd233865abd12aa3cde06
2021-01-11 10:14:11 +08:00
Jon Atack
79a2576af1
doc: update ConnectionType Doxygen documentation 2021-01-10 21:34:17 +01:00
Hennadii Stepanov
3642b2ed34
refactor, net: Increase CNode data member encapsulation
All protected CNode data members could be private.
2021-01-10 12:00:46 +02:00
Hennadii Stepanov
acebb79d3f
refactor, move-only: Relocate CNode private members 2021-01-10 12:00:44 +02:00
MarcoFalke
555fc0789d
Merge #20881: fuzz: net permission flags in net processing
fad327ca65 fuzz: net permission flags in net processing (MarcoFalke)

Pull request description:

  to increase coverage

ACKs for top commit:
  Crypt-iQ:
    cr ACK fad327c
  practicalswift:
    ACK fad327ca65

Tree-SHA512: f8643d1774ff13524ab97ab228ad070489e080435e5742af26e6e325fd002e4c1fd78b9887e11622e79d6fe0c4daaddce5e033e6cd4b32e50fd68b434aab7333
2021-01-10 10:33:57 +01:00
Anthony Towns
0d246a59b6 net, net_processing: move NetEventsInterface method docs to net.h 2021-01-09 23:27:45 +10:00
MarcoFalke
9158d6f341
Merge #20786: net: [refactor] Prefer integral types in CNodeStats
faecb74562 Expose integral m_conn_type in CNodeStats, remove m_conn_type_string (Jon Atack)

Pull request description:

  Currently, strings are stored for what are actually integral (strong) enum types. This is fine, because the strings are only used as-is for the debug log and RPC. However, it complicates using them in the GUI. User facing strings in the GUI should be translated and only string literals can be picked up for translation, not runtime `std::string`s.

  Fix that by removing the `std::string` members and replace them by strong enum integral types.

ACKs for top commit:
  jonatack:
    Code review ACK faecb74562
  theStack:
    Code review ACK faecb74562 🌲

Tree-SHA512: 24df2bd0645432060e393eb44b8abaf20fe296457d07a867b0e735c3e2e75af7b03fc6bfeca734ec33ab816a7c8e1f8591a5ec342f3afe3098a4e41f5c2cfebb
2021-01-08 15:14:53 +01:00
Amiti Uttarwar
5bc04e8837 [rpc/net] Introduce addconnection to test outbounds & blockrelay
Add a new RPC endpoint to enable opening outbound connections from
the tests. The functional test framework currently uses the addnode RPC, which
has different behavior than general outbound peers. These changes enable
creating both full-relay and block-relay-only connections. The new RPC
endpoint calls through to a newly introduced AddConnection method on
CConnman that ensures we stay within the allocated max.
2021-01-07 10:15:56 -08:00
MarcoFalke
fad327ca65
fuzz: net permission flags in net processing 2021-01-07 19:07:02 +01:00
Hennadii Stepanov
a8d9f275d0
net: Add libnatpmp support 2021-01-07 18:07:09 +02:00
Hennadii Stepanov
cf151cc68c
scripted-diff: Rename UPnP stuff
-BEGIN VERIFY SCRIPT-
sed -i 's/g_upnp_interrupt/g_mapport_interrupt/' src/mapport.cpp
sed -i 's/if(g_upnp_thread/if (g_mapport_thread/' src/mapport.cpp
sed -i 's/g_upnp_thread/g_mapport_thread/' src/mapport.cpp
sed -i 's/LOCAL_UPNP/LOCAL_MAPPED/' src/mapport.cpp
sed -i 's/\bupnp\b/mapport/' src/mapport.cpp
sed -i 's/LOCAL_UPNP,  /LOCAL_MAPPED,/' src/net.h
-END VERIFY SCRIPT-
2021-01-07 18:07:08 +02:00
Hennadii Stepanov
02ccf69dd6
refactor: Move port mapping code to its own module
This commit does not change behavior.
2021-01-07 18:06:58 +02:00
MarcoFalke
fad1f0fd33
net: Remove unused cs_feeFilter 2021-01-07 15:25:47 +01:00
Jon Atack
faecb74562
Expose integral m_conn_type in CNodeStats, remove m_conn_type_string 2021-01-07 15:18:44 +01:00
MarcoFalke
fa210689e2
net: Move SocketSendData lock annotation to header
Also, add lock annotation to SendMessages

Can be reviewed with "--word-diff-regex=."
2021-01-07 09:41:34 +01:00
MarcoFalke
fa0a71781a
net: Move CConnman/NetEventsInterface after CNode in header file
Can be reviewed with --color-moved=dimmed-zebra --patience
2021-01-07 09:40:49 +01:00
MarcoFalke
f13e03cda2
Merge #20584: Declare de facto const reference variables/member functions as const
31b136e580 Don't declare de facto const reference variables as non-const (practicalswift)
1c65c075ee Don't declare de facto const member functions as non-const (practicalswift)

Pull request description:

  _Meta: This is the second and final part of the `const` refactoring series (part one: #20581). **I promise: no more refactoring PRs from me in a while! :)** I'll now go back to focusing on fuzzing/hardening!_

  Changes in this PR:
  * Don't declare de facto const member functions as non-const
  * Don't declare de facto const reference variables as non-const

  Awards for finding candidates for the above changes go to:
  * `clang-tidy`'s [`readability-make-member-function-const`](https://clang.llvm.org/extra/clang-tidy/checks/readability-make-member-function-const.html)  check ([list of `clang-tidy` checks](https://clang.llvm.org/extra/clang-tidy/checks/list.html))
  * `cppcheck`'s `constVariable` check ([list of `cppcheck` checks](https://sourceforge.net/p/cppcheck/wiki/ListOfChecks/))

  See #18920 for instructions on how to analyse Bitcoin Core using Clang Static Analysis, `clang-tidy` and `cppcheck`.

ACKs for top commit:
  ajtowns:
    ACK 31b136e580
  jonatack:
    ACK 31b136e580
  theStack:
    ACK 31b136e580 ❄️

Tree-SHA512: f58f8f00744219426874379e9f3e9331132b9b48e954d24f3a85cbb858fdcc98009ed42ef7e7b4619ae8af9fc240a6d8bfc1c438db2e97b0ecd722a80dcfeffe
2021-01-07 09:05:09 +01:00
MarcoFalke
4eada5d8b1
Merge #20816: net: Move RecordBytesSent() call out of cs_vSend lock
378aedc452 [net] Add cs_vSend lock annotations (John Newbery)
673254515a [net] Move RecordBytesSent() call out of cs_vSend lock (John Newbery)

Pull request description:

  RecordBytesSent() does not require cs_vSend to be locked, so reduce the scope of cs_vSend.

  Also correctly annotate the CNode data members that are guarded by cs_vSend.

  This is a simpler alternative to #19673.

ACKs for top commit:
  jnewbery:
    ok, reverting to commit 378aedc which has two ACKs already. Any style issues can be fixed up in future PRs.
  troygiorshev:
    ACK 378aedc452
  theStack:
    re-ACK 378aedc452
  MarcoFalke:
    review ACK 378aedc452 🔌

Tree-SHA512: e9cd6c472b7e1479120c1bf2d1c640cf6d18c7d589a5f9b7dfc4875e5790adaab403a7a1b945a47e79e7249a614b8583270e4549f89b22e8a9edb2e4818b0d07
2021-01-06 07:07:35 +01:00
MarcoFalke
417f95fa45
Merge #19915: p2p, refactor: Use Mutex type for some mutexes in CNode class
0e51a35512 refactor: Use Mutex type for some mutexes in CNode class (Hennadii Stepanov)

Pull request description:

  No need the `RecursiveMutex` type for the `CNode::cs_vSend`, `CNode::cs_hSocket` and `CNode::cs_vRecv`.

  Related to #19303.

ACKs for top commit:
  jnewbery:
    utACK 0e51a35512
  MarcoFalke:
    review ACK 0e51a35512 🔊

Tree-SHA512: 678ee5e3c15ad21a41cb86ec7179741bd505a138638fdc07f41d6d677c38fbf2208219bfc0509e3675e721fc8d8816e858070db7b87c5d72ad93aae81f7e1636
2021-01-05 12:19:08 +01:00
John Newbery
378aedc452 [net] Add cs_vSend lock annotations 2021-01-02 16:51:44 +00:00
MarcoFalke
faaa4f2b6a
refactor: Remove nMyStartingHeight from CNode/Connman 2021-01-02 10:24:45 +01:00
MarcoFalke
ae8f797135
Merge #20210: net: assert CNode::m_inbound_onion is inbound in ctor, add getter, unit tests
86c495223f net: add CNode::IsInboundOnion() public getter and unit tests (Jon Atack)
6609eb8cb5 net: assert CNode::m_inbound_onion is inbound in ctor (Jon Atack)
993d1ecd19 test, fuzz: fix constructing CNode with invalid inbound_onion (Jon Atack)

Pull request description:

  The goal of this PR is to be able to depend on `m_inbound_onion` in AttemptToEvictConnection in #20197:

  - asserts `CNode::m_inbound_onion` is inbound in the CNode ctor to have a validity check at the class boundary
  - fixes a unit test and a fuzz utility that were passing invalid inbound onion values to the CNode ctor
  - drops an unneeded check in `CNode::ConnectedThroughNetwork()` for its inbound status
  - adds a public getter `IsInboundOnion()` that also allows unit testing it
  - adds unit test coverage

ACKs for top commit:
  sipa:
    utACK 86c495223f
  LarryRuane:
    ACK 86c495223f
  vasild:
    ACK 86c495223f
  MarcoFalke:
    review ACK 86c495223f 🐍

Tree-SHA512: 21109105bc4e5e03076fadd489204be00eac710c9de0127708ca2d0a10a048ff81f640f589a7429967ac3eb51d35fe24bb2b12e53e7aa3efbc47aaff6396d204
2021-01-02 09:54:01 +01:00
Wladimir J. van der Laan
d875bcc8f9
Merge #162: Add network to peers window and peer details
e262a19b0b gui: display network in peer details (Jon Atack)
9136953073 gui: rename peer tab column headers, initialize in .h (Hennadii Stepanov)
05c08c696a gui: add network column in peers tab/window (Jon Atack)
e0e55060bf gui: fix broken doxygen formatting in src/qt/guiutil.h (Jon Atack)
0d5613f9de gui: create GUIUtil::NetworkToQString() utility function (Jon Atack)
af9103cc79 net, rpc: change CNodeStats::m_network from string to Network (Jon Atack)

Pull request description:

  and rename peers window column headers from NodeId and Node/Service to Peer Id and Address.

  ![Screenshot from 2020-12-27 14-45-31](https://user-images.githubusercontent.com/2415484/103172228-efec8600-4849-11eb-8cee-04a3d2ab1273.png)

ACKs for top commit:
  laanwj:
    ACK e262a19b0b

Tree-SHA512: 709c2a805c109c2dd033aca7b6b6dc94ebe2ce7a0168c71249e1e661c9c57d1f1c781a5b9ccf3b776bedeb83ae2fb5c505637337c45b1eb9a418cb1693a89761
2020-12-28 23:56:23 +01:00
Jon Atack
af9103cc79
net, rpc: change CNodeStats::m_network from string to Network 2020-12-27 14:28:31 +01:00
Amiti Uttarwar
b1a936d4ae [rpc] Remove deprecated "whitelisted" field from getpeerinfo 2020-12-26 13:30:54 -08:00
Amiti Uttarwar
537053336f [rpc] Remove deprecated "addnode" field from getpeerinfo 2020-12-26 13:30:08 -08:00
John Newbery
184557e8e0 [net processing] Move hashContinue to net processing
Also rename to m_continuation_block to better communicate meaning.
2020-12-20 10:03:38 +00:00
John Newbery
53b7ac1b7d [net processing] Move block inventory data to Peer 2020-12-20 10:01:48 +00:00
John Newbery
78040f9168 [net processing] Rename nStartingHeight to m_starting_height
Not done as a scripted diff to avoid misnaming the local variable in
ProcessMessage().
2020-12-20 10:01:46 +00:00
John Newbery
77a2c2f8f9 [net processing] Move nStartingHeight to Peer 2020-12-20 10:01:26 +00:00
Jon Atack
86c495223f
net: add CNode::IsInboundOnion() public getter and unit tests 2020-12-17 19:56:12 +01:00
Jon Atack
6609eb8cb5
net: assert CNode::m_inbound_onion is inbound in ctor
and drop an unneeded check in CNode::ConnectedThroughNetwork()
2020-12-17 19:56:10 +01:00
Wladimir J. van der Laan
ad3d4b3929
Merge #20661: Only select from addrv2-capable peers for torv3 address relay
37fe80e626 Only consider addrv2 peers for relay of non-addrv1 addresses (Pieter Wuille)
83f8821a6f refactor: add IsAddrCompatible() to CNode (Pieter Wuille)

Pull request description:

  When selecting peers to relay an address to, only pick addrv2-capable ones if the address cannot be represented in addr(v1).

  Without this I expect that propagation of torv3 addresses over the cleartext network will be very hard for a while.

ACKs for top commit:
  jonatack:
    ACK 37fe80e626
  vasild:
    ACK 37fe80e626

Tree-SHA512: 18a854ea43ad473cf89b9c5193b524109d7af75c26f7aa7e26cd72ad0db52f19c8001d566c607a7e6772bc314f770f09b6c3e07282d110c5daea193edc592cd2
2020-12-16 18:09:06 +01:00
MarcoFalke
b440c33179
Merge #20477: net: Add unit testing of node eviction logic
fee88237e0 Assert eviction at >= 29 candidates. Assert non-eviction at <= 20 candidates. (practicalswift)
685c428de0 test: Add unit testing of node eviction logic (practicalswift)
ed73f8cee0 net: Move eviction node selection logic to SelectNodeToEvict(...) (practicalswift)

Pull request description:

  Add unit testing of node eviction logic.

  Closes #19966.

ACKs for top commit:
  jonatack:
    ACK fee88237e0
  MarcoFalke:
    ACK fee88237e0 🐼

Tree-SHA512: 0827c35609122ca42bfabb17feaaee35c191ab4dc2e428282af425a6c176eaeaff2789b74a4f7eb4ca6b8cb10603068e90ca800e6ef3bc3904d50e76616f7a2b
2020-12-16 13:30:55 +01:00
practicalswift
ed73f8cee0 net: Move eviction node selection logic to SelectNodeToEvict(...) 2020-12-16 12:00:15 +00:00
Pieter Wuille
83f8821a6f refactor: add IsAddrCompatible() to CNode 2020-12-15 12:45:32 -08:00
MarcoFalke
a35a3466ef
Merge #20653: doc: Move addr relay comment in net to correct place
fa86217e97 doc: Move add relay comment in net to correct place (MarcoFalke)

Pull request description:

  The comment was previously attached to `m_addr_known`, but now it is attached to `id`, which is wrong.

  Fix that by moving the comment to `RelayAddrsWithConn`.

ACKs for top commit:
  practicalswift:
    cr ACK fa86217e97: patch looks correct
  jnewbery:
    ACK fa86217e97
  theStack:
    Code review ACK fa86217e97 🌳

Tree-SHA512: ec3d5f1996aded38947d2a5fd0bb63539e88f83964cd3254984002edfd51abb4dde813c7c81619a8a3a5c55b7e9ae83c8c5be8ad6c84b4593ed3bbf463fe8979
2020-12-15 17:56:11 +01:00
MarcoFalke
fa86217e97
doc: Move add relay comment in net to correct place
Can be reviewed with
--ignore-all-space --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2020-12-14 18:15:51 +01:00
fanquake
0475c8ba4d
net: use std::chrono throughout maxOutbound logic 2020-12-13 11:41:33 +08:00
fanquake
f805933e70
init: set nMaxOutboundLimit connection option directly
DEFAULT_MAX_UPLOAD_TARGET is a compile time constant.
2020-12-13 11:12:05 +08:00
fanquake
173d0d35f1
net: remove nMaxOutboundTimeframe from connection options
It's not actually possible to change this value, so remove the
indirection of it being a conn option.

DEFAULT_MAX_UPLOAD_TIMEFRAME is a compile time constant.
2020-12-13 11:10:40 +08:00
fanquake
b117eb1486
net: remove SetMaxOutboundTimeframe
This was introduced in 872fee3fcc and it's unclear
if it's ever been used.
2020-12-13 10:38:24 +08:00