Commit Graph

23180 Commits

Author SHA1 Message Date
fanquake
ad345909b2
doc: remove Boost Chrono from install docs 2020-03-07 08:34:31 +08:00
fanquake
e21fa542b1
test: remove Boost Chrono installation from CI 2020-03-07 08:34:31 +08:00
fanquake
bd37f2bc26
build: remove Boost Chrono detection from build system 2020-03-07 08:34:31 +08:00
fanquake
1d0a87e712
build: remove chrono package from depends Boost 2020-03-07 08:34:30 +08:00
fanquake
3d28c886f0
Merge #18286: build: Add locale fuzzer to FUZZERS_MISSING_CORPORA (and unbreak Travis! :))
0d0bc3b5c1 build: Add locale fuzzer to FUZZERS_MISSING_CORPORA (practicalswift)

Pull request description:

  Add `locale` fuzzer to `FUZZERS_MISSING_CORPORA`.

  This is a follow-up to #18126 which broke Travis. Sorry about that :)

ACKs for top commit:
  fanquake:
    ACK 0d0bc3b5c1

Tree-SHA512: c0968dc798839f87c891d1dfccf5541883ac56b51a29f52244e78c221c9c087d2dea0a959612d907d53b29fca1f486b340227b17653227ecbf6ca5ab0e85b0d3
2020-03-07 08:04:53 +08:00
practicalswift
0d0bc3b5c1 build: Add locale fuzzer to FUZZERS_MISSING_CORPORA 2020-03-06 23:29:23 +00:00
fanquake
4d80274b99
Merge #18241: wallet/refactor: refer to CWallet immutably when possible
79facb11e9 wallet: use constant CWallets in rpcwallet.cpp (Karl-Johan Alm)
d9b0ebc1da wallet: make ReserveDestination pwallet ivar const (Karl-Johan Alm)
57c569e4d9 wallet: make BackupWallet() const (Karl-Johan Alm)
df3a818d2a wallet: make getters const (Karl-Johan Alm)
227b9dd2d6 wallet/spkm: make GetOldestKeyPoolTime() const (Karl-Johan Alm)
22d329ad0e wallet: use constant CWallets in rpcdump.cpp (Karl-Johan Alm)
7b3587b29d wallet/db: make IsDummy() const (Karl-Johan Alm)
d366795d18 wallet/db: make Backup() const (Karl-Johan Alm)
8cd0b86340 wallet: make CanGetAddresses() const (Karl-Johan Alm)
037fa770eb wallet: make KeypoolCountExternalKeys() const (Karl-Johan Alm)
ddc93557ad wallet: make CanGenerateKeys() const (Karl-Johan Alm)
dc2d0650fd make BlockUntilSyncedToCurrentChain() const (Karl-Johan Alm)

Pull request description:

  A lot of places refer to `CWallet*`'s as `CWallet * const`, which translates to *"an immutable pointer to a mutable `CWallet` instance"*; this is

  1. often not what the author meant, especially as a lot of these places do not at all modify the wallet object, and
  2. confusing, as it tends to suggest that this is a proper way to refer to a constant `CWallet` instance.

  This PR changes references to wallets to `const CWallet* const` whenever immutability is expected. This should result in no behavioral changes at all, and improved compile-time error checking.

  Note from irc:

  > <sipa> sounds good to me; this is the sort of change that as long as it compiles, the behavior shouldn't change
  > <sipa> though in general it may lead to introducing automatic copying of objects sometimes (e.g. trying to std::move a const object will work, but generally result in a copy rather than an efficient move)
  > <sipa> CWallet objects aren't copied or moved though

ACKs for top commit:
  laanwj:
    ACK 79facb11e9
  Empact:
    ACK 79facb11e9
  promag:
    ACK 79facb11e9.
  fjahr:
    ACK 79facb11e9

Tree-SHA512: 80a80c1a52f0f788d0ccb268b53bc0f46c796643a3c5a22b55bbbde4ffa6c7e347784e5e53b1e488a3b4e14399e31d5be9417ad5b6319c74a462609e9b1a98e8
2020-03-07 07:24:54 +08:00
MarcoFalke
fab7d14ea5
test: Check that wait_until returns if time point is in the past 2020-03-06 16:08:12 -05:00
Wladimir J. van der Laan
3516a31eaa
Merge #18234: refactor: Replace boost::mutex,condition_var,chrono with std equivalents in scheduler
70a6b529f3 lint-cppcheck: Remove -DHAVE_WORKING_BOOST_SLEEP_FOR (Anthony Towns)
294937b39d scheduler_tests: re-enable mockforward test (Anthony Towns)
cea19f6859 Drop unused reverselock.h (Anthony Towns)
d0ebd93270 scheduler: switch from boost to std (Anthony Towns)
b9c4260127 sync.h: add REVERSE_LOCK (Anthony Towns)
306f71b4eb scheduler: don't rely on boost interrupt on shutdown (Anthony Towns)

Pull request description:

  Replacing boost functionality with C++11 stuff.

  Motivated by #18227, but should stand alone. Changing from `boost::condition_var` to `std::condition_var` means `threadGroup.interrupt_all` isn't enough to interrupt `serviceQueue` anymore, so that means calling `stop()` before `join_all()` is needed. And the existing reverselock.h code doesn't work with sync.h's DebugLock code (because the reversed lock won't be removed from `g_lockstack` which then leads to incorrect potential deadlock warnings), so I've replaced that with a dedicated class and macro that's aware of our debug lock behaviour.

  Fixes #16027, Fixes #14200, Fixes #18227

ACKs for top commit:
  laanwj:
    ACK 70a6b529f3

Tree-SHA512: d1da13adeabcf9186d114e2dad9a4fdbe2e440f7afbccde0c13dfbaf464efcd850b69d3371c5bf8b179d7ceb9d81f4af3cc22960b90834e41eaaf6d52ef7d331
2020-03-06 20:51:56 +01:00
MarcoFalke
45cdcd47d9
Merge #18126: tests: Add fuzzing harness testing the locale independence of the strencodings.h functions
259e290db8 tests: Add fuzzing harness for locale independence testing (practicalswift)

Pull request description:

  Context: [C and C++ locale assumptions in bitcoind and bitcoin-qt](https://github.com/bitcoin/bitcoin/pull/18124)

  Add fuzzing harness for locale independence testing of functions in `strencodings.h` and `tinyformat.h`.

  Test this PR using:

  ```
  $ make distclean
  $ ./autogen.sh
  $ CC=clang CXX=clang++ ./configure --enable-fuzz \
        --with-sanitizers=address,fuzzer,undefined
  $ make
  $ src/test/fuzz/locale
  …
  ```

  The tested functions (`ParseInt32(…)`, `ParseInt64(…)`, `atoi(const std::string&)`, `atoi64(const std::string& str)`, `i64tostr(const char*)`, `itostr(…)`, `strprintf(…)`) all call locale dependent functions (such as `strtol(…)`, `strtoll(…)`, `atoi(const char*)`, etc.) but are assumed to do so in a way that the tested functions return same results regardless of the chosen C locale (`setlocale`).

  This fuzzer aims to test that those assumptions hold up also in practice now and over time.

Top commit has no ACKs.

Tree-SHA512: d108d2f85aa6f482839dafbc7579465ffd4bacf7bc52835ad0fbaa1c71aed9b3870c83447b3d453a03b9ce307e76a3cfdd350a0c77024ab094c93c7d62c8a527
2020-03-06 14:31:11 -05:00
Anthony Towns
70a6b529f3 lint-cppcheck: Remove -DHAVE_WORKING_BOOST_SLEEP_FOR 2020-03-07 04:20:41 +10:00
practicalswift
259e290db8 tests: Add fuzzing harness for locale independence testing 2020-03-06 13:29:21 +00:00
Anthony Towns
294937b39d scheduler_tests: re-enable mockforward test 2020-03-06 23:14:10 +10:00
Anthony Towns
cea19f6859 Drop unused reverselock.h 2020-03-06 23:14:10 +10:00
Anthony Towns
d0ebd93270 scheduler: switch from boost to std
Changes from boost::chrono to std::chrono, boost::condition_var to
std::condition_var, boost::mutex to sync.h Mutex, and reverselock.h to
sync.h REVERSE_LOCK. Also adds threadsafety annotations to CScheduler
members.
2020-03-06 23:14:08 +10:00
Anthony Towns
b9c4260127 sync.h: add REVERSE_LOCK 2020-03-06 23:13:31 +10:00
Anthony Towns
306f71b4eb scheduler: don't rely on boost interrupt on shutdown
Calling interrupt_all() will immediately stop the scheduler, so it's
safe to invoke stop() beforehand, and this removes the reliance on boost
to interrupt serviceQueue().
2020-03-06 23:13:31 +10:00
fanquake
97aadf98d0
Merge #16117: util: Replace boost sleep with std sleep
fae86c38bc util: Remove unused MilliSleep (MarcoFalke)
fa9af06d91 scripted-diff: Replace MilliSleep with UninterruptibleSleep (MarcoFalke)
fa4620be78 util: Add UnintrruptibleSleep (MarcoFalke)

Pull request description:

  We don't use the interruptible feature of boost's sleep anywhere, so replace it with the sleep in `std::thread`

ACKs for top commit:
  ajtowns:
    ACK fae86c38bc quick code review
  practicalswift:
    ACK fae86c38bc -- patch looks correct
  sipa:
    Concept and code review ACK fae86c38bc
  fanquake:
    ACK fae86c38bc - note that an instance of `DHAVE_WORKING_BOOST_SLEEP_FOR` was missed in the [linter](https://github.com/bitcoin/bitcoin/blob/master/test/lint/extended-lint-cppcheck.sh#L69), but that can be cleaned up later.

Tree-SHA512: 7c0f8eb197664b9f7d9fe6c472c77d384f11c797c913afc31de4b532e3b4fd9ea6dd174f92062ff9d1ec39b25e0900ca7c597435add87f0f2477d9557204848c
2020-03-06 15:41:00 +08:00
MarcoFalke
3f826598a4
Merge #17972: tests: Add fuzzing harness for CKey and key related functions
f4691b6c21 tests: Add fuzzing harness for CKey related functions (practicalswift)

Pull request description:

  Add fuzzing harness for `CKey` and key related functions.

  **How to test this PR**

  ```
  $ make distclean
  $ ./autogen.sh
  $ CC=clang CXX=clang++ ./configure --enable-fuzz \
        --with-sanitizers=address,fuzzer,undefined
  $ make
  $ src/test/fuzz/key
  …
  #4096   pulse  cov: 5736 ft: 6960 corp: 27/833b lim: 67 exec/s: 2048 rss: 122Mb
  #8192   pulse  cov: 5736 ft: 6960 corp: 27/833b lim: 103 exec/s: 2048 rss: 143Mb
  #13067  NEW    cov: 5736 ft: 6965 corp: 28/865b lim: 154 exec/s: 2177 rss: 166Mb L: 32/32 MS: 1 ChangeBit-
  #16384  pulse  cov: 5736 ft: 6965 corp: 28/865b lim: 182 exec/s: 2048 rss: 181Mb
  #32768  pulse  cov: 5736 ft: 6965 corp: 28/865b lim: 347 exec/s: 2184 rss: 258Mb
  …
  ```

Top commit has no ACKs.

Tree-SHA512: 5b17ffb70c31966d3eac06d2258c127ae671d28d6cdf4e6ac20b45cd59ad32f80952c9c749930b97d317c72d5f840a3b75d466fd28fb6c351424a72c3e41bcbc
2020-03-05 16:43:16 -05:00
practicalswift
f4691b6c21 tests: Add fuzzing harness for CKey related functions 2020-03-05 21:11:10 +00:00
MarcoFalke
a2b5aae9f3
Merge #17996: tests: Add fuzzing harness for serialization/deserialization of floating-points and integrals
9ff41f6419 tests: Add float to FUZZERS_MISSING_CORPORA (temporarily) (practicalswift)
8f6fb0a85a tests: Add serialization/deserialization fuzzing for integral types (practicalswift)
3c82b92d2e tests: Add fuzzing harness for functions taking floating-point types as input (practicalswift)
c2bd588860 Add missing includes (practicalswift)

Pull request description:

  Add simple fuzzing harness for functions with floating-point parameters (such as `ser_double_to_uint64(double)`, etc.).

  Add serialization/deserialization fuzzing for integral types.

  Add missing includes.

  To test this PR:

  ```
  $ make distclean
  $ ./autogen.sh
  $ CC=clang CXX=clang++ ./configure --enable-fuzz \
        --with-sanitizers=address,fuzzer,undefined
  $ make
  $ src/test/fuzz/float
  …
  ```

Top commit has no ACKs.

Tree-SHA512: 9b5a0c4838ad18d715c7398e557d2a6d0fcc03aa842f76d7a8ed716170a28f17f249eaede4256998aa3417afe2935e0ffdfaa883727d71ae2d2d18a41ced24b5
2020-03-05 15:41:30 -05:00
practicalswift
9ff41f6419 tests: Add float to FUZZERS_MISSING_CORPORA (temporarily) 2020-03-05 20:35:26 +00:00
practicalswift
8f6fb0a85a tests: Add serialization/deserialization fuzzing for integral types 2020-03-05 20:35:26 +00:00
MarcoFalke
d7134b306a
Merge #17917: tests: Add amount compression/decompression fuzzing to existing fuzzing harness
7e9c7113af compressor: Make the domain of CompressAmount(...) explicit (practicalswift)
4a7fd7a712 tests: Add amount compression/decompression fuzzing to existing fuzzing harness: test compression round-trip (practicalswift)

Pull request description:

  Small fuzzing improvement:

  Add amount compression/decompression fuzzing to existing fuzzing harness: test compression round-trip (`DecompressAmount(CompressAmount(…))`).

  Make the domain of `CompressAmount(…)` explicit.

  Amount compression primer:

  ```
      Compact serialization for amounts

      Special serializer/deserializer for amount values. It is optimized for
      values which have few non-zero digits in decimal representation. Most
      amounts currently in the txout set take only 1 or 2 bytes to
      represent.
  ```

  **How to test this PR**

  ```
  $ make distclean
  $ ./autogen.sh
  $ CC=clang CXX=clang++ ./configure --enable-fuzz \
        --with-sanitizers=address,fuzzer,undefined
  $ make
  $ src/test/fuzz/integer
  …
  ```

Top commit has no ACKs.

Tree-SHA512: 0f7c05b97012ccd5cd05a96c209e6b4d7d2fa73138bac9615cf531baa3f614f9003e29a198015bcc083af9f5bdc752bb52615b82c5df3c519b1a064bd4fc6664
2020-03-05 15:25:36 -05:00
practicalswift
7e9c7113af compressor: Make the domain of CompressAmount(...) explicit 2020-03-05 20:22:47 +00:00
MarcoFalke
891464950b
Merge #18109: tests: Avoid hitting some known minor tinyformat issues when fuzzing strprintf(...)
470e2ac602 tests: Avoid hitting some known minor tinyformat issues when fuzzing strprintf(...) (practicalswift)

Pull request description:

  Avoid hitting some known minor tinyformat issues when fuzzing `strprintf(...)`. These can be removed when the issues have been resolved upstreams :)

  Note to reviewers: The `%c` and `%*` issues are also present for `%<some junk>c` and `%<some junk>*`. That is why simply matching on `"%c"` or `"%*"` is not enough. Note that the intentionally trivial skipping logic overshoots somewhat (`c[…]%` is filtered in addition to `%[…]c`).

Top commit has no ACKs.

Tree-SHA512: 2b002981e8b3f2ee021c3013f1260654ac7e158699313849c9e9660462bb8cd521544935799bb8daa74925959dc04d63440e647495e0b008cfe1b8a8b2202d40
2020-03-05 15:08:31 -05:00
Wladimir J. van der Laan
727857d12d
Merge #18112: Serialization improvements step 5 (blockencodings)
353f376277 Convert blockencodings.h to new serialization framework (Pieter Wuille)
e574fff53e Add CustomUintFormatter (Pieter Wuille)
10633398f2 Add DifferenceFormatter (Russell Yanofsky)
56dd9f04c7 Make VectorFormatter support stateful formatters (Russell Yanofsky)
3ca574cef0 Convert CCompactSize to proper formatter (Pieter Wuille)

Pull request description:

  This is probably the most involved change in the sequence of changes extracted from #10785.

  In order to implement the differential encoding of BIP152, this change changes `VectorFormatter` to permit a stateful sub-formatter, which is then used by `DifferenceFormatter`. A `CustomUintFormatter` is added as well to do the 48-bit serialization of short ids.

ACKs for top commit:
  laanwj:
    ACK 353f376277, nice change
  ryanofsky:
    Code review ACK 353f376277. Only changes since last review are suggested assert change and MASK->MAX rename

Tree-SHA512: 976618991a8be62ba0738725b7cfa166a56cde998ebf1031ba6f28557032f1577b666ac7ae25cd498c0e1e740108c3c56a342620b724df41d6cc9d8bdafac037
2020-03-05 19:56:26 +01:00
MarcoFalke
aaf09469fb
Merge #18260: refactor: Fix implicit value conversion in formatPingTime
1891245e73 refactor: Cast ping values to double before output (Ben Woosley)
7a810b1d7a refactor: Convert ping wait time from double to int64_t (Ben Woosley)
e6fc63ec7e refactor: Convert min ping time from double to int64_t (Ben Woosley)
b054c46977 refactor: Convert ping time from double to int64_t (Ben Woosley)

Pull request description:

  Alternative to #18252, see motivation there.

  This changes `CNodeStats` to handle ping timestamps as their original incoming usec `int64_t` values until the time they need to be displayed.

ACKs for top commit:
  vasild:
    ACK 1891245
  practicalswift:
    ACK 1891245e73 -- patch looks correct
  promag:
    ACK 1891245e73, added cast to double and also braces.

Tree-SHA512: 7cfcba941d9751b522b8c512c25da493338b444637bd0bb711b152d7d86b431ca0968956be3c844ee9dbfea25edab44a0de2afa44f2c9c0bf5b8df53eba66272
2020-03-05 13:50:10 -05:00
MarcoFalke
96488e6784
Merge #18263: rpc: change setmocktime check to use IsMockableChain
2455aa5d7f [rpc] changed MineBlocksOnDemand to IsMockableChain (Gloria Zhao)

Pull request description:

  Change: Update the if statement in `setmocktime` to use `IsMockableChain` chainparams function (aka `m_is_mockable_chain`) instead of `MineBlocksOnDemand`

  Rationale: It's a more appropriate check for whether or not chain is in RegTest, as [discussed](https://github.com/bitcoin/bitcoin/pull/18037#discussion_r376509388) in #18037

ACKs for top commit:
  MarcoFalke:
    ACK 2455aa5d7f 🙇
  jonatack:
    ACK 2455aa5d7f

Tree-SHA512: 1d8c8b7ff0b3c1bcbf5755194969b6664fe05a35003375ad08d18e34bcefd2df4f64d0e60078a10bbef3c8f469a9b9d07db467089b55c14cf532304bc965bffc
2020-03-05 13:40:06 -05:00
Gloria Zhao
2455aa5d7f
[rpc] changed MineBlocksOnDemand to IsMockableChain 2020-03-05 10:09:28 -08:00
David O'Callaghan
8a2a652e6f Remove redundant type information from rpc docs
Co-Authored-By: MarcoFalke <falke.marco@gmail.com>
2020-03-05 15:35:47 +00:00
Wladimir J. van der Laan
a2a77ba34f
Merge #18056: ci: Check for submodules
2a95c7c956 ci: Check for submodules (Emil Engler)

Pull request description:

  See #18019.
  The current solution looks like this (I also tested with multiple submodules):
  ```
  These submodules were found, delete them:
   355a5a310019659d9bf6818d2fd66fbb214dfed7 curl (curl-7_68_0-108-g355a5a310)
  ```
  The submodule example command was `git submodule add https://github.com/curl/curl.git curl`

ACKs for top commit:
  laanwj:
    ACK 2a95c7c956

Tree-SHA512: 64bf388123f0a88d12e3e41ff29bc190339377a0615c35dc3f2700bb7773470a8fa426e0ff57188a60ed88bded39f75082ff0b73118651ff403b163422395005
2020-03-05 16:33:54 +01:00
fanquake
d0601e67f1
Merge #17812: config, net, test: asmap feature refinements and functional tests
1ba3e1cc21 init: move asmap code earlier in init process (Jon Atack)
5ba829e12e rpc: fix getpeerinfo RPCResult `mapped_as` type (Jon Atack)
c90b9a2399 net: extract conditional to bool CNetAddr::IsHeNet (Jon Atack)
819fb5549b logging: asmap logging and #include fixups (Jon Atack)
dcaf543ba0 test: add functional test for an empty, unparsable asmap (Jon Atack)
b8d0412b21 config: separate the asmap finding and parsing checks (Jon Atack)
81c38a2497 config: enable passing -asmap an absolute file path (Jon Atack)
fbe9b024f0 config: use default value in -asmap config (Jon Atack)
08b992675c test: add feature_asmap functional tests (Jon Atack)

Pull request description:

  This PR builds on PR #16702 to add functional tests / sanity checks and user-facing refinements for passing `-asmap` to configure ASN-based IP bucketing in addrman. As per our review discussion in that PR, the idea here is to handle aspects like functional tests and config arg handling that can help the PR be merged while enabling the author to focus on the bucketing itself.

  - [x] add feature functional tests to verify node behaviour and debug log output when launching

    - `bitcoind` with no `-asmap` arg

    - `bitcoind -asmap=RELATIVE_FILENAME` to the unit test data skeleton asmap

    - `bitcoind -asmap` with no filename specified using the default asmap file

    - `bitcoind -asmap` with no filename specified and a missing default asmap file

  - [x] add the ability to pass absolute path filenames to the `-asmap` config arg in addition to datadir-relative path filenames as per https://github.com/bitcoin/bitcoin/pull/16702#discussion_r361300447, and add test coverage

  - [x] separate the asmap file finding and parsing checks, which allows adding tests for the case of a found but unparseable or empty asmap

  - [x] add test for an empty asmap

  - [x] various asmap fixups

  - [x] move the asmap init code earlier in the init process to provide immediate feedback when passing an  `-asmap` config arg. This speeds up the `feature_asmap` functional test from 60 to 5 seconds! Credit to Wladimir J. van der Laan for the suggestion.

ACKs for top commit:
  practicalswift:
    ACK 1ba3e1cc21 -- diff looks correct
  fanquake:
    ACK 1ba3e1cc21

Tree-SHA512: e9094460a597ac5597449acfe631c87b71d3ede6a12c7ae61b26d1161b3eefed8e7e25c4fb0505864cebd89300b7c4cf9378060aa9155441029315df15fa3283
2020-03-05 20:13:33 +08:00
Ben Woosley
1891245e73
refactor: Cast ping values to double before output
Note the divisor is a floating point literal so presumably
also floating point.
2020-03-05 04:44:50 -05:00
fanquake
cbc32d67dc
Merge #18249: test: Bump timeouts to accomodate really slow disks
fa6df0de53 test: Bump timeouts to accomodate really slow disks (MarcoFalke)

Pull request description:

  Needed these patches locally for some arm machines with slow storage

ACKs for top commit:
  practicalswift:
    ACK fa6df0de53
  fanquake:
    ACK fa6df0de53

Tree-SHA512: 22f2f6f7ed05f26013431126bb179b029dbc931f02d0e58f8970c6d477f43e3106d76c9732942034cb2cfcb827191e338a082f953ccb69531a19ee6dab9a7e1a
2020-03-05 15:06:52 +08:00
fanquake
2492dc0068
Merge #18259: doc: Merge release notes for 0.20.0 release
fa8b6020ec doc: Merge release notes for 0.20.0 release (MarcoFalke)

Pull request description:

  mostly move-only. Can be reviewed with the `--color-moved=dimmed-zebra` option.

ACKs for top commit:
  laanwj:
    ACK fa8b6020ec
  fanquake:
    ACK fa8b6020ec - any changes are basically headers and newlines.

Tree-SHA512: 7273c7625d60c3b28bafc4371e17545bd9fcaa672fde8492a0b4ab88081d616dd41c77389d18a9a3b39b595c5409a354bf511745ddcb9834c9a25d91b94edb28
2020-03-05 10:25:39 +08:00
Ben Woosley
7a810b1d7a
refactor: Convert ping wait time from double to int64_t 2020-03-04 13:45:29 -05:00
Ben Woosley
e6fc63ec7e
refactor: Convert min ping time from double to int64_t 2020-03-04 13:44:57 -05:00
Ben Woosley
b054c46977
refactor: Convert ping time from double to int64_t 2020-03-04 13:44:25 -05:00
MarcoFalke
fa8b6020ec
doc: Merge release notes for 0.20.0 release 2020-03-04 10:06:23 -05:00
Jon Atack
1ba3e1cc21
init: move asmap code earlier in init process
and update feature_asmap.py and test_runner.py

This commit moves the asmap init.cpp code from the end of "Step 12: start node"
to "Step 6: network initialization" to provide feedback on passing an -asmap
config arg much more quickly. This change speeds up the feature_asmap.py
functional test file from 60 to 5 seconds by accelerating the 2 tests that use
`assert_start_raises_init_error`.

Credit to Wladimir J. van der Laan for the suggestion.
2020-03-04 14:54:30 +01:00
Jon Atack
5ba829e12e
rpc: fix getpeerinfo RPCResult mapped_as type
and mention it is only available if the asmap config flag is set.
2020-03-04 14:54:27 +01:00
Jon Atack
c90b9a2399
net: extract conditional to bool CNetAddr::IsHeNet
and remove redundant public declaration
2020-03-04 14:31:31 +01:00
Jon Atack
819fb5549b
logging: asmap logging and #include fixups
- move asmap #includes to sorted positions in addrman and init (move-only)

- remove redundant quotes in asmap InitError, update test

- remove full stops from asmap logging to be consistent with debug logging,
  update tests
2020-03-04 14:24:19 +01:00
Jon Atack
dcaf543ba0
test: add functional test for an empty, unparsable asmap
This is now testable after separating the asmap finding and parsing checks in
the previous commit.
2020-03-04 14:24:17 +01:00
Jon Atack
b8d0412b21
config: separate the asmap finding and parsing checks
and update the tests.
2020-03-04 14:24:15 +01:00
Jon Atack
81c38a2497
config: enable passing -asmap an absolute file path
- allow passing an absolute file path to the -asmap config arg

- update the -asmap config help

- add a functional test in feature_asmap.py
2020-03-04 14:24:13 +01:00
Jon Atack
fbe9b024f0
config: use default value in -asmap config
and move to sorted position
2020-03-04 14:24:11 +01:00
Jon Atack
08b992675c
test: add feature_asmap functional tests
to verify node behaviour and debug log when launching bitcoind in these cases:

1. `bitcoind` with no -asmap arg, using /16 prefix for IP bucketing

2. `bitcoind -asmap=<relative path>`, using the unit test skeleton asmap

3. `bitcoind -asmap/-asmap=` with no file specified, using the default asmap

4. `bitcoind -asmap` with no file specified, and a missing default asmap file

The tests are order-independent. The slowest test (missing default asmap file)
is placed last.
2020-03-04 14:24:08 +01:00
MarcoFalke
a71c34742c
Merge #17809: rpc: Auto-format RPCResult
fa6b061fc1 rpc: Auto-format RPCResult (MarcoFalke)
fa7d0503d3 rpc: Move OuterType enum to header (MarcoFalke)

Pull request description:

  This enforces most syntax rules of the RPCResult at compile time (or some at run time during unit and functional tests)

  Apart from normalizing the syntax, by separating stylistic formatting from the structure, we could in theory directly generate the html for e.g. https://bitcoincore.org/en/doc/0.19.0/rpc/wallet/importmulti/

ACKs for top commit:
  Sjors:
    Indeed, re-ACK fa6b061fc1
  ajtowns:
    ACK fa6b061fc1 -- skimmed code changes and differences to rpc help output

Tree-SHA512: 5b510b3aa0b7c7b9189a48c77593159409069f939145b9a00c5478e894cf65f994d44d633eb7bb7dbea40ee820645a2930976c24772379d96929002b120efa28
2020-03-04 08:16:57 -05:00