Commit Graph

27857 Commits

Author SHA1 Message Date
MarcoFalke
22220ef6d5
test: Move P2WSH_OP_TRUE to shared test library 2021-02-17 11:36:30 +01:00
MarcoFalke
569b5ba1dc
Merge #21121: [test] Small unit test improvements, including helper to make mempool transaction
1363b6c27d [doc / util] Use comments to clarify time unit for int64_t type. (Amiti Uttarwar)
47a7a1687d [util] Introduce a SetMockTime that takes chrono time (Amiti Uttarwar)
df6a5fc1df [util] Change GetMockTime to return chrono type instead of int (Amiti Uttarwar)
a2d908e1da [test] Throw error instead of segfaulting in failure scenario (Amiti Uttarwar)
9a3bbe8fc5 [test] Introduce a unit test helper to create a valid mempool transaction. (Amiti Uttarwar)

Pull request description:

  Some miscellaneous improvements that came up when working on #21061
  - The first commit is a helper to make valid mempool transactions & submit via ATMP. Introducing in this PR, using in #21061.
  - The second commit is a small improvement in `miner_tests.cpp` that uses `BOOST_REQUIRE_EQUAL` to properly terminate the program instead of segfaulting in the failure scenario where the blocks do not include the expected number of transactions.
  - The third commit changes the function signature of `GetMockTime()` to return a chrono type.
  - The fourth & fifth commit overload `SetMockTime` to also accept chrono type, and adds documentation to indicate that the `int64_t` function signature is deprecated.

ACKs for top commit:
  vasild:
    ACK 1363b6c27d

Tree-SHA512: c72574d73668ea04ee4c33858f8de68b368780f445e05afb569aaf8564093f8112259b3afe93cf6dc2ee12a1ab5af1130ac73c16416132c1ba2851c054a67d78
2021-02-17 10:40:09 +01:00
John Newbery
9f21ed4037 [test] Check user agent string from test framework connections
Add a check that new connections from the test framework to the
node have the correct user agent string. This makes bugs easier
to detect if the user agent string ever changes.
2021-02-17 09:29:44 +00:00
John Newbery
9ce4c3c4c1 [test] Add P2P_SERVICES to p2p.py
The messages.py module should contain code and helpers for
[de]serializing p2p messages. Specific usage of those messages should
be in p2p.py. Therefore specify the nServices value in the calling code,
not in the messages.py module.
2021-02-17 09:29:41 +00:00
John Newbery
010542614d [test] Move MY_RELAY to p2p.py
messages.py is for message and primitive data structures. Specifics
about the test framework's p2p implementation should be in p2p.py.

Also rename to P2P_VERSION_RELAY. Also rename msg_version.nRelay to
relay. In Bitcoin Core, this is referred to as fRelay, since it's a
bool, so this field has always been misnamed.
2021-02-17 09:23:32 +00:00
John Newbery
9b4054cb7a [test] Move MY_SUBVERSION to p2p.py
The messages.py module should contain code and helpers for
[de]serializing p2p messages. Specific usage of those messages should
be in p2p.py. Therefore move MY_SUBVERSION to p2p.py.

Also rename to P2P_SUBVERSION.
2021-02-17 09:22:37 +00:00
John Newbery
7e158a6910 [test] Move MY_VERSION to p2p.py
The messages.py module should contain code and helpers for
[de]serializing p2p messages. Specific usage of those messages should
be in p2p.py. Therefore move MY_VERSION to p2p.py.

Also rename to P2P_VERSION to distinguish it from
other versioning used in Bitcoin/Bitcoin Core.

Also always set the nVersion field in CBlockLocator to 0 and ignore the
field in deserialized messages. The field is not currently used for
anything in Bitcoin Core.
2021-02-17 09:00:53 +00:00
John Newbery
652311165c [test] Move MIN_VERSION_SUPPORTED to p2p.py
The messages.py module should contain code and helpers for
[de]serializing p2p messages. Specific usage of those messages should
be in p2p.py. Therefore move MIN_VERSION_SUPPORTED to p2p.py.

Also rename to MIN_P2P_VERSION_SUPPORTED to distinguish it from
other versioning used in Bitcoin/Bitcoin Core.
2021-02-17 09:00:24 +00:00
MarcoFalke
8639c446d8
Merge #21188: scripted-diff: Remove redundant lock annotations in net processing
fafddfadda scripted-diff: Remove shadowing lock annotations (MarcoFalke)

Pull request description:

  Would be good to not redundantly copy the lock annotation from the class declaration to the member implementation. Otherwise it may not result in a compile failure if a new lock requirement is added to the member implementation, but not the class declaration.

ACKs for top commit:
  amitiuttarwar:
    ACK `fafddfadda`, confirmed that the annotations removed were all redundant. confirmed the claim of potential issue :)
  hebasto:
    ACK fafddfadda
  jonatack:
    Light utACK fafddfadda verified that the removed annotations in the definitions correspond to those in their respective declarations

Tree-SHA512: ea095c6d4e0bedd70d4e2d8a42b06cfd90c161ebfcaac13558c5dc065601a732e5f812f332104b7daa087aa57b8b0242b177799d22eef7628d77d4d87f443bf2
2021-02-17 09:53:29 +01:00
MarcoFalke
7f831346cb
Merge #20380: doc: Add instructions on how to fuzz the P2P layer using Honggfuzz NetDriver
fd0be92cff doc: Add instructions on how to fuzz the P2P layer using Honggfuzz NetDriver (practicalswift)

Pull request description:

  Add instructions on how to fuzz the P2P layer using [Honggfuzz NetDriver](http://blog.swiecki.net/2018/01/fuzzing-tcp-servers.html).

  Honggfuzz NetDriver allows for very easy fuzzing of TCP servers such as Bitcoin Core without having to write any custom fuzzing harness. The `bitcoind` server process is largely fuzzed without modification.

  This makes the fuzzing highly realistic: a bug reachable by the fuzzer is likely also remotely triggerable by an untrusted peer.

Top commit has no ACKs.

Tree-SHA512: 9e98cb30f00664c00c8ff9fd224ff9822bff3fd849652172df48dbaeade1dd1a5fc67ae53203f1966a1d4210671b35656009a2d8b84affccf3ddf1fd86124f6e
2021-02-17 09:50:56 +01:00
MarcoFalke
69f7f50aa5
Merge #20993: test: store subversion (user agent) as string in msg_version
de85af5cce test: store subversion (user agent) as string in msg_version (Sebastian Falbesoner)

Pull request description:

  It seems more natural to treat the "subversion" field (=user agent string, see [BIP 14](https://github.com/bitcoin/bips/blob/master/bip-0014.mediawiki#Proposal)) of a node as pure string rather than a bytestring within the test framework. This is also suggested with the naming prefix in `msg_version.strSubVer`: one probably wouldn't expect a field starting with "str" to be a bytestring that needs further decoding to be useful. This PR moves the encoding/decoding parts to the serialization/deserialization routines so that the user doesn't have to bother with that anymore.

  Note that currently, in the master branch the `msg_version.strSubVer` is never read (only in `msg_version.__repr__`); However, one issue that is solved by this PR came up while testing #19509 (not merged yet): A decoding script for binary message capture files takes use of the functional test framework convert it into JSON format. Bytestrings will be convered to hexstrings, while pure strings will (surprise surprise) end up without modification in the file.

  So without this patch, we get:

  ```
  $ jq . out.json | grep -m5 strSubVer
        "strSubVer": "2f5361746f7368693a32312e39392e302f"
        "strSubVer": "2f5361746f7368693a302e32302e312f"
        "strSubVer": "2f5361746f7368693a32312e39392e302f"
        "strSubVer": "2f5361746f7368693a302e32302e312f"
        "strSubVer": "2f5361746f7368693a32312e39392e302f"
  ```

  After this patch:

  ```
  $ jq . out2.json | grep -m5 strSubVer
        "strSubVer": "/Satoshi:21.99.0/"
        "strSubVer": "/Satoshi:0.20.1/"
        "strSubVer": "/Satoshi:21.99.0/"
        "strSubVer": "/Satoshi:0.20.1/"
        "strSubVer": "/Satoshi:21.99.0/"
  ```

ACKs for top commit:
  jnewbery:
    utACK de85af5cce

Tree-SHA512: ff23642705c858e8387a625537dfec82e6b8a15da6d99b8d12152560e52d243ba17431b602b26f60996d897e00e3f37dcf8dc8a303ffb1d544df29a5937080f9
2021-02-17 09:36:30 +01:00
MarcoFalke
77772a1b80
doc: Rework internal and external links 2021-02-17 09:18:46 +01:00
MarcoFalke
9266f7497f
util: Use std::chrono for time getters 2021-02-17 12:26:39 +08:00
Cory Fields
3c2e16be22
time: add runtime sanity check
std::chrono::system_clock.time_since_epoch and time_t(0) are not guaranteed
to use the Unix epoch timestamp, but in practice they almost certainly will.
Any differing behavior will be assumed to be an error, unless certain
platforms prove to consistently deviate, at which point we'll cope with it
by adding offsets.

Do a quick runtime check to verify that
time_t(0) == std::chrono::system_clock's epoch time == unix epoch.

Co-authored-by: Anthony Towns <aj@erisian.com.au>
2021-02-17 12:26:04 +08:00
fanquake
36be9b821a
Merge #21087: guix: Passthrough BASE_CACHE into container
901f54321b guix: Passthrough BASE_CACHE into container (Carl Dong)

Pull request description:

  This allows depends-built packages to be cached.

ACKs for top commit:
  MarcoFalke:
    Approach ACK 901f54321b
  fanquake:
    ACK 901f54321b

Tree-SHA512: 464815f41fc081d7956bec84380668834b6ee6751c7a3d56daad6e1fc91e582de4bbdd1a89f399b1136f2adc4d9941517cfe4db694f0ee5bf59bf2f44fc6fda0
2021-02-17 12:25:06 +08:00
fanquake
c5da2749e2
build: actually stop configure if Boost isn't available
If Boost is not found via AX_BOOST_BASE, we don't actually stop
configuring, only a warning is emitted:
```bash
checking for boostlib >= 1.58.0 (105800)... configure: We could not detect the boost libraries (version MINIMUM_REQUIRED_BOOST or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.
```

Instead we would usually fail when one of the other
AX_BOOST_* macros fails to find a library. These macros are slowly being
removed, and in any case, it makes more sense to fail earlier if Boost
is missing.

If Boost is unavailable, the failure now looks like:
```bash
checking for boostlib >= 1.58.0 (105800)... configure: We could not detect the boost libraries (version 1.58.0 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.
configure: error: Boost is not available!
```

Note that we now just pass the version into AX_BOOST_BASE, which fixes
it's display in the output (rather than MINIMUM_REQUIRED_BOOST).
2021-02-17 09:17:37 +08:00
fanquake
cad8b527ea
build: explicitly install libboost-dev package
This package is currently installed as a side-effect of installing our
other libboost-*-dev packages. However as those continue to dissapear,
it makes sense to install boost dev explicitly.
2021-02-17 09:04:20 +08:00
fanquake
7c8e605bf4
Merge #21159: test: fix sign comparison warning in socket tests
9cc8e30125 test: fix sign comparison warning in socket tests (fanquake)

Pull request description:

  This fixes:
  ```bash
  In file included from test/sock_tests.cpp:10:
  In file included from /usr/local/include/boost/test/unit_test.hpp:18:
  In file included from /usr/local/include/boost/test/test_tools.hpp:46:
  /usr/local/include/boost/test/tools/old/impl.hpp:107:17: warning: comparison of integers of different signs: 'const long' and 'const unsigned long' [-Wsign-compare]
      return left == right;
             ~~~~ ^  ~~~~~
  ```

  which was introduced in #20788.

ACKs for top commit:
  practicalswift:
    cr ACK 9cc8e30125
  vasild:
    ACK 9cc8e30125

Tree-SHA512: 7069a4fde5cec01be03f8477fe396e53658f170efbf1d9ef3339d553bb90a2be9f4acd6b348127b14cd2f91426e0cd1fc35d2d3c9f201cf748c0cf50f47e46a5
2021-02-17 08:26:42 +08:00
fanquake
7bf04e358a
build: remove mostly pointless BOOST_PROCESS macro
Performing a series of link checks for a Boost component that is
header-only doesn't make much sense, and currently means we just have
another confusing Boost macro in our tree. I'm not sure why this was
originally done this way; maybe Sjors or luke-jr can elaborate
(#15382 (929cda5470))?

The macro also has the side-effect of producing confusing error
messages. i.e in #20744, the CI is currently failing with:
```bash
checking for boostlib >= 1.58.0 (105800) lib path in "/tmp/cirrus-ci-build/depends/x86_64-pc-linux-gnu/lib"... yes
checking for boostlib >= 1.58.0 (105800)... yes
checking whether the Boost::Process library is available... yes
configure: error: Could not find a version of the Boost::Process library!
```

This isn't useful, given there is no such thing as a `Boost::Process`
library.

This PR just removes the macro entirely, but maintains a `--with-boost-process`
(defaulting to off), flag to configure. Hopefully this will also be
removed, in favour of `--enable-disable-external-signer` if/when #16546
is merged.
2021-02-17 08:04:11 +08:00
Jon Atack
6bfbc97d71 test: disallow sendtoaddress/sendmany when private keys disabled 2021-02-16 15:49:28 -05:00
Andrew Chow
0997019e76 Disallow sendtoaddress and sendmany when private keys disabled 2021-02-16 15:49:28 -05:00
Amiti Uttarwar
1363b6c27d [doc / util] Use comments to clarify time unit for int64_t type. 2021-02-16 12:23:00 -08:00
Amiti Uttarwar
47a7a1687d [util] Introduce a SetMockTime that takes chrono time 2021-02-16 12:23:00 -08:00
Amiti Uttarwar
df6a5fc1df [util] Change GetMockTime to return chrono type instead of int 2021-02-16 12:23:00 -08:00
Amiti Uttarwar
a2d908e1da [test] Throw error instead of segfaulting in failure scenario
If the miner code is faulty and does not include any transactions in a block,
the code segfaults when it tries to access block transactions. Instead, add a
check that safely aborts the process.
2021-02-16 12:23:00 -08:00
Amiti Uttarwar
9a3bbe8fc5 [test] Introduce a unit test helper to create a valid mempool transaction. 2021-02-16 12:23:00 -08:00
Wladimir J. van der Laan
92fee79dab
Merge #19806: validation: UTXO snapshot activation
1afc0e4aa1 doc: remove potentially confusing ChainstateManager comment (James O'Beirne)
769a1ef9fd test: Add tests with maleated snapshot data (Fabian Jahr)
4d8de04f32 tests: add snapshot activation test (James O'Beirne)
31d225274f tests: add deterministic chain generation unittest fixture (James O'Beirne)
6606a4f8c6 move-onlyish: break out CreateUTXOSnapshot from dumptxoutset (James O'Beirne)
ad949ba449 txdb: don't reset during in-memory cache resize (James O'Beirne)
f6e2da5fb7 simplify ChainstateManager::SnapshotBlockhash() return semantics (James O'Beirne)
7a6c46b37e chainparams: add allowed assumeutxo values (James O'Beirne)

Pull request description:

  This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11):

  Parent PR: #15606
  Issue: #15605
  Specification: https://github.com/jamesob/assumeutxo-docs/tree/master/proposal

  ---

  This change proposes logic for activating UTXO snapshots, which is unused at the moment aside from an included unittest. There are a few moveonyish/refactoring commits to allow for halfway decent unittests.

  Basic structure is included for specifying and checking the assumeutxo hash values used to validate activated snapshots. Initially I had specified a few height/hash pairs for mainnet in this change, but because of the security-critical nature of those parameters, I figured it was better to leave their inclusion to a future PR that includes only that change - my intent being that reviewers will be more likely to verify those parameters firsthand in a dedicated PR.

  Aside from that and the snapshot activation logic, there are a few related changes:

  - ~~allow caching the `nChainTx` value in the CCoinsViewDB; this is set during snapshot activation. Because we don't necessarily have access to the full chain at the time of snapshot load, this value is communicated through the snapshot metadata and must be cached within the chainstate to survive restarts.~~
  - break out `CreateUTXOSnapshot()` from dumptxoutset. This is essentially a move-only change to allow the reuse of snapshot creation logic from within unittests.
  - ...and a few other misc. changes that are solely related to unittests.

  The move-onlyish commit is most easily reviewed with `--color-moved=zebra`.

ACKs for top commit:
  fjahr:
    Code review ACK 1afc0e4aa1
  laanwj:
    Code review ACK 1afc0e4aa1

Tree-SHA512: a4e4f0698f00a53ec298b5e8b7ef1c9fdf0185f95139d1b1f63cfdf6cbbd6d17b8c6e51bbf1de2e5f1a946bf49f8466232698ef55acce5a012c80b067da366ea
2021-02-16 19:23:06 +01:00
MarcoFalke
3c9d9d21e1
Merge #21008: test: fix zmq test flakiness, improve speed
ef21fb7313 zmq test: speedup test by whitelisting peers (immediate tx relay) (Sebastian Falbesoner)
5c6546362d zmq test: fix flakiness by using more robust sync method (Sebastian Falbesoner)
8666033630 zmq test: accept arbitrary sequence start number in ZMQSubscriber (Sebastian Falbesoner)
6014d6e1b5 zmq test: dedup message reception handling in ZMQSubscriber (Sebastian Falbesoner)

Pull request description:

  Fixes #20934 by using the "sync up" method described in https://github.com/bitcoin/bitcoin/issues/20538#issuecomment-738791868.

  After improving robustness with this approach (commits 1-3), it turned out that there were still some fails, but those were unrelated to zmq: Out of 500 runs, 3 times `sync_mempool()` or `sync_blocks()` timed out, which can happen because the trickle relay time has no upper bound -- hence in rare cases, it takes longer than 60s. This is fixed by enabling immediate tx relay on node1 (commit 4), which as a nice side-effect also gives us a rough 2x speedup for the test.

  For further details, also see the explanations in the commit messages.

  There is no guarantee that the test is still not flaky, but it would help if potential reviewers would run the following script locally and report how many runs failed (feel free to do less than 1000 runs, as this takes quite a long if ran with `--valgrind`):
  ```
  #!/bin/sh
  OUTPUT_FILE=./zmq_results
  echo ===== repeated zmq test ===== > $OUTPUT_FILE

  for i in `seq 1000`; do
      echo ------------------------
      echo ----- test run $i -----
      echo ------------------------
      echo --- $i --- >> $OUTPUT_FILE
      ./test/functional/interface_zmq.py --valgrind
      if [ $? -ne 0 ]; then
          echo "FAILED. /o\\" >> $OUTPUT_FILE
      else
          echo "PASSED. \\o/" >> $OUTPUT_FILE
      fi
  done

  echo Failed test runs:
  grep FAILED $OUTPUT_FILE | wc -l
  ```

ACKs for top commit:
  jonatack:
    Light ACK ef21fb7313 with the caveat that I was unable to make the test fail with valgrind both here and on master, so I can't vouch that it actually fixes the CI flakiness. The test does run ~2x faster with this.

Tree-SHA512: 7a1e7592fbbd98e69e1e1294486b91253e589c72b3c6bbb7f587028ec07cca59b7d984e4ebf256c4bc3e8a529ec77d31842f3dd874038aea0b684abfea50306a
2021-02-16 18:56:20 +01:00
Carl Dong
901f54321b guix: Passthrough BASE_CACHE into container
This allows depends-built packages to be cached.
2021-02-16 12:17:33 -05:00
MarcoFalke
faa137eb9e
test: Speed up rpc_blockchain.py by removing miniwallet.generate() 2021-02-16 17:47:55 +01:00
MarcoFalke
fa1fe80c75
test: Change address type from P2PKH to P2WSH in rpc_blockchain
This change does not matter for the test, except that it increases
the bogosize due to the increase in the size of the scriptPubKey
2021-02-16 17:47:48 +01:00
MarcoFalke
fa4d8f3169
test: Cache 25 mature coins for ADDRESS_BCRT1_P2WSH_OP_TRUE 2021-02-16 16:49:08 +01:00
MarcoFalke
fad25153f5
test: Remove unused bug workaround 2021-02-16 16:28:40 +01:00
MarcoFalke
faabce7d07
test: Start only the number of nodes that are needed 2021-02-16 16:25:50 +01:00
MarcoFalke
fa55159b9e
net: Log to net debug in MaybeDiscourageAndDisconnect except for noban and manual peers 2021-02-16 13:29:00 +01:00
fanquake
9bbf08bf98
Merge #20721: Net: Move ping data to net_processing
a5e15ae45c scripted-diff: rename ping members (John Newbery)
45dcf22661 [net processing] Move ping data fields to net processing (John Newbery)
dd2646d12c [net processing] Move ping timeout logic to net processing (John Newbery)
0b43b81f69 [net processing] Move send ping message logic into function (John Newbery)
1a07600b4b [net] Add RunInactivityChecks() (John Newbery)
f8b3058992 [net processing] Add Peer& arg to MaybeDiscourageAndDisconnect() (John Newbery)

Pull request description:

  This continues the work of moving application layer data into net_processing, by moving all ping data into the new Peer object added in #19607.

  For motivation, see #19398.

ACKs for top commit:
  glozow:
    reACK a5e15ae45c
  MarcoFalke:
    review ACK a5e15ae45c 🥉
  amitiuttarwar:
    ACK a5e15ae45c

Tree-SHA512: fb84241613d6a6e1f2832fa5378030b5877a02e8308188f57ab545a6eaf2ab731a93abb7dcd3a7f7285bb66700f938096378a8e90cd6a3e6f3309f81d85a344e
2021-02-16 18:48:30 +08:00
Jonas Schnelli
84716b134e Add "index/blockfilterindex -> validation -> index/blockfilterindex" to expected circular dependencies 2021-02-16 10:30:41 +01:00
Jonas Schnelli
ab3a0a2fb9 Add functional test for blockfilterindex in prune-mode 2021-02-16 10:30:37 +01:00
Jonas Schnelli
c286a22f7b Add debug startup parameter -fastprune for more effective pruning tests 2021-02-16 10:26:17 +01:00
Jonas Schnelli
5e112269c3 Avoid pruning below the blockfilterindex sync height 2021-02-16 10:26:15 +01:00
MarcoFalke
b55dc3ad84
Merge #21185: fuzz: Remove expensive and redundant muhash from crypto fuzz target
ffff84a9cb fuzz: Remove expensive and redundant muhash from crypto fuzz target (MarcoFalke)

Pull request description:

  Remove because it is redundant with `src/test/fuzz/muhash.cpp` and incredibly expensive

ACKs for top commit:
  practicalswift:
    Tested ACK ffff84a9cb

Tree-SHA512: c91ea2406db857127c789b9cdeb714a719d88b54132e9cef74fffd229532d874b6c043353793ec687504b5784afc74995f8982243d41f976b63d57454a5ed339
2021-02-16 07:54:28 +01:00
Wladimir J. van der Laan
882ce25132 cli: Treat high detail levels as the maximum in -netinfo
I somehow often type `-netinfo 5` which gets treated as `-netinfo 0`,
after this change it's `-netinfo 4` which seems more convenient behavior.
2021-02-15 20:01:52 +01:00
John Newbery
a5e15ae45c scripted-diff: rename ping members
-BEGIN VERIFY SCRIPT-
sed -i 's/fPingQueued/m_ping_queued/g' src/net_processing.cpp
sed -i 's/nMinPingUsecTime/m_min_ping_time/g' src/net.* src/net_processing.cpp src/test/net_tests.cpp
sed -i 's/nPingNonceSent/m_ping_nonce_sent/g' src/net_processing.cpp
sed -i 's/nPingUsecTime/m_last_ping_time/g' src/net.*
-END VERIFY SCRIPT-
2021-02-15 16:15:51 +00:00
John Newbery
45dcf22661 [net processing] Move ping data fields to net processing 2021-02-15 16:15:51 +00:00
John Newbery
dd2646d12c [net processing] Move ping timeout logic to net processing
Ping messages are an application-level mechanism. Move timeout
logic from net to net processing.
2021-02-15 16:02:43 +00:00
John Newbery
0b43b81f69 [net processing] Move send ping message logic into function 2021-02-15 16:02:43 +00:00
John Newbery
1a07600b4b [net] Add RunInactivityChecks()
Moves the logic to prevent running inactivity checks until
the peer has been connected for -peertimeout time into its
own function. This will be reused by net_processing later.
2021-02-15 16:02:43 +00:00
John Newbery
f8b3058992 [net processing] Add Peer& arg to MaybeDiscourageAndDisconnect()
Refactor only. No change in behaviour.
2021-02-15 16:02:43 +00:00
MarcoFalke
489030f2a8
Merge #20965: net, rpc: return NET_UNROUTABLE as not_publicly_routable, automate helps
96635e6177 init: use GetNetworkNames() in -onlynet help (Jon Atack)
0dbde700a6 rpc: use GetNetworkNames() in getnetworkinfo and getpeerinfo helps (Jon Atack)
1c3af37881 net: create GetNetworkNames() (Jon Atack)
b45eae4d53 net: update NET_UNROUTABLE to not_publicly_routable in GetNetworkName() (Jon Atack)

Pull request description:

  per the IRC discussion today at http://www.erisian.com.au/bitcoin-core-dev/log-2021-01-19.html#l-87

  - return a more helpful string name for `Network::NET_UNROUTABLE`: "not_publicly_routable" instead of "unroutable"
  - update the RPC getpeerinfo "network" help, and automate it and the getnetworkinfo "network#name" and the -onlynet help doc generation

ACKs for top commit:
  theStack:
    re-ACK 96635e6177 🌳
  MarcoFalke:
    review ACK 96635e6177 🐗

Tree-SHA512: 511a7d987126b48a7a090739aa7c4964b6186a3ff8f5f7eec9233dd816c6b7a6dc91b3ea6b824aa68f218a8a3ebdc6ffd214e9a88af38f2bf23f3257c4284c3a
2021-02-15 15:31:15 +01:00
MarcoFalke
cb073bed00
Merge #21167: net: make CNode::m_inbound_onion public, initialize explicitly
2ee4a7a9ec net: remove CNode::m_inbound_onion defaults for explicitness (Jon Atack)
24bda56c29 net: make CNode::m_inbound_onion public, drop getter, update tests (Jon Atack)

Pull request description:

  Refactoring only, no change in behavior. This is a quick follow-up to #20210 to address these review comments:

  - https://github.com/bitcoin/bitcoin/pull/20210#discussion_r528835313
  - https://github.com/bitcoin/bitcoin/pull/20210#discussion_r550860416
  - https://github.com/bitcoin/bitcoin/pull/20210#issuecomment-766093925

  Changes:
  - make the `CNode::m_inbound_onion class` member public, update the Doxygen comment, drop the getter, and update the tests
  - remove the `CNode::m_inbound_onion` default value initialization in the ctor declaration and the member initializer in favor of always passing it explicitly to the ctor where we initialize it dynamically, to both clarify the caller code and to allow the compiler to warn if it is uninitialized in the ctor or omitted in the caller

ACKs for top commit:
  MarcoFalke:
    review ACK 2ee4a7a9ec 🏀
  vasild:
    ACK 2ee4a7a9ec

Tree-SHA512: 72961c91168885a9d881756b10bad9d587f5ce297d5a6493c23e267b7178ff22b697bc6868e7761d6304e372d2781453d30011a020afd506b1e308b4ffa5feee
2021-02-15 15:22:21 +01:00