Commit Graph

30687 Commits

Author SHA1 Message Date
merge-script
a8a272ac32
Merge bitcoin/bitcoin#22734: addrman: Avoid crash on corrupt data, Force Check after deserialize
fa3669f72f fuzz: Move all addrman fuzz targets to one file (MarcoFalke)
fa7a883f5a addrman: Replace assert with throw on corrupt data (MarcoFalke)
fa298971e6 Refactor: Turn the internal addrman check helper into a forced check (MarcoFalke)
fae5c633dc move-only: Move CAddrMan::Check to cpp file (MarcoFalke)

Pull request description:

  Assert should only be used for program internal logic errors, not to sanitize external user input.

  The assert was introduced via the debug-only runtime option `-checkaddrman` in commit 803ef70fd9, thus won't need a backport.

  Also, it doesn't really make sense to continue when the deserialized addrman doesn't pass the sanity check.

  For example, if `nLastSuccess` is negative, it would  later result in integer overflows. Thus, this patch fixes #22931.

  Also,
  Fixes #22503
  Fixes #22504
  Fixes #22519

  Closes #22498

  Steps to test:

  ```
  mkdir -p /tmp/test_235/regtest/
  echo 'H4sIAAAAAAAAA/u1f+stZmUGYgELgwPRakfBKBgFo2AUjIJRMApGwSgYBaNgFIyCUTBswdyGpFnLjUKjP9e0bvjYusl6b+L2e7Vs2dd6N//Pua0/xQUALJAn93IQAAA=' | base64 --decode | zcat > /tmp/test_235/regtest/peers.dat
  ./src/qt/bitcoin-qt -regtest -datadir=/tmp/test_235/ -checkaddrman=1 -printtoconsole | grep -A2 'Loading P2P addresses'
  ```

  Output before:
  ```
  2021-09-10T11:28:37Z init message: Loading P2P addresses…
  2021-09-10T11:28:37Z ADDRMAN CONSISTENCY CHECK FAILED!!! err=-16
  bitcoin-qt: addrman.cpp:765: void CAddrMan::Check() const: Assertion `false' failed.

  (program crashes)
  ```

  Output after:
  ```
  2021-09-10T11:26:00Z init message: Loading P2P addresses…
  2021-09-10T11:26:00Z Error: Invalid or corrupt peers.dat (Corrupt data. Consistency check failed with code -16: iostream error). If you believe this is a bug, please report it to https://github.com/bitcoin/bitcoin/issues. As a workaround, you can move the file ("/tmp/test_235/regtest/peers.dat") out of the way (rename, move, or delete) to have a new one created on the next start.

  (program exits)
  ```

ACKs for top commit:
  naumenkogs:
    ACK fa3669f72f
  jnewbery:
    Code review ACK fa3669f72f
  vasild:
    ACK fa3669f72f

Tree-SHA512: 687e4a4765bbc66495152fa7a49d28ee84b405dc5370ba87b4016b5593e45f54c4ce5cae579e4d433e0e082d20fc263969fa602679c911accef0adb2d6213bd6
2021-09-21 18:21:00 +02:00
merge-script
ae674a0198
Merge bitcoin/bitcoin#22998: test: use MiniWallet for make_utxo helper in feature_rbf.py
f680d27155 test: use MiniWallet for make_utxo helper in feature_rbf.py (Sebastian Falbesoner)
0f27524602 test: scale amounts in test_doublespend_tree down by factor 10 (Sebastian Falbesoner)
d1e2481274 test: scale amounts in test_doublespend_chain down by factor 10 (Sebastian Falbesoner)

Pull request description:

  This PR aims to further increase MiniWallet usage in the functional test feature_rbf.py by using it in the `make_utxo(...)` helper, which is the only part that needs a wallet for most sub-tests. In order to do that, the amounts for the utxos have to be scaled down in two sub-tests first (`test_doublespend_chain` and `test_doublespend_tree`, see first two commits), since we need amounts passed to `make_utxo` than can be funded by only one input. For creating UTXOs with a value of 50 BTC, we'd need to implement a method for consolidating multiple utxos into one first, which seems to be overkill.

  Note that after this PR's change, there is only one sub-test left (`test_rpc`) that needs the wallet compiled into bitcoind.

ACKs for top commit:
  MarcoFalke:
    review ACK f680d27155 🦐

Tree-SHA512: 46c8c245086a9e79855c4ede2f8f412333cf2658136805196b203b3567c89398d77fcb80715c0bb72fdc84331cc67544b2fdc259193a3adcb2fc36e147c26fce
2021-09-21 15:20:07 +02:00
MarcoFalke
fa3669f72f
fuzz: Move all addrman fuzz targets to one file
Can be reviewed with --color-moved=dimmed-zebra
2021-09-21 10:09:56 +02:00
MarcoFalke
fa7a883f5a
addrman: Replace assert with throw on corrupt data
Assert should only be used for program internal logic errors, not to
sanitize external user input.
2021-09-21 10:09:45 +02:00
MarcoFalke
fa298971e6
Refactor: Turn the internal addrman check helper into a forced check 2021-09-21 10:07:48 +02:00
MarcoFalke
fae5c633dc
move-only: Move CAddrMan::Check to cpp file
This speeds up compilation of the whole program because the included
header file is smaller.

Can be reviewed with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2021-09-21 10:07:38 +02:00
fanquake
8f022a59b8
Merge bitcoin/bitcoin#22993: build: set OSX_MIN_VERSION to 10.15
a43b8e9555 build: set OSX_MIN_VERSION to 10.15 (fanquake)

Pull request description:

  Taken out of #20744, as splitting up some of the build changes was mentioned [here](https://github.com/bitcoin/bitcoin/pull/22937#discussion_r707303172).

  This is required to use `std::filesystem` on macOS, as support for it only landed in the libc++.dylib shipped with 10.15. So if we want to move to using `std::filesystem` for `23.0`, this bump is required.

  See also: https://developer.apple.com/documentation/xcode-release-notes/xcode-11-release-notes

  > Clang now supports the C++17 \<filesystem\> library for iOS 13, macOS 10.15, watchOS 6, and tvOS 13.

  macOS 10.15 was released in October 2019. macOS OS's seem to have a life of about 3 years, so it's possible that 10.14 will become officially unsupported by the end of 2021 and prior to the release of 23.0.

  Guix builds:
  ```bash
  bash-5.1# find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
  abc8b749be65f1339dcdf44bd1ed6ade2533b8e3b5030ad1dde0ae0cede78136  guix-build-a43b8e955558/output/dist-archive/bitcoin-a43b8e955558.tar.gz
  1edcc301eb4c02f3baa379beb8d4c78e661abc24a293813bc9d900cf7255b790  guix-build-a43b8e955558/output/x86_64-apple-darwin19/SHA256SUMS.part
  e9dbb5594a664519da778dde9ed861c3f0f631525672e17a67eeda599f16ff44  guix-build-a43b8e955558/output/x86_64-apple-darwin19/bitcoin-a43b8e955558-osx-unsigned.dmg
  11b23a17c630dddc7594c25625eea3de42db50f355733b9ce9ade2d8eba3a8f3  guix-build-a43b8e955558/output/x86_64-apple-darwin19/bitcoin-a43b8e955558-osx-unsigned.tar.gz
  257ba64a327927f94d9aa0a68da3a2695cf880b3ed1a0113c5a966dcc426eb5e  guix-build-a43b8e955558/output/x86_64-apple-darwin19/bitcoin-a43b8e955558-osx64.tar.gz
  ```

ACKs for top commit:
  hebasto:
    ACK a43b8e9555
  jarolrod:
    ACK a43b8e9

Tree-SHA512: 9ac77be7cb56c068578860a3b2b8b7487c9e18b71b14aedd77a9c663f5d4bb19756d551770c02ddd12f1797beea5757b261588e7b67fb53509bb998ee8022369
2021-09-21 15:37:12 +08:00
merge-script
223ad2fd0d
Merge bitcoin/bitcoin#22831: test: add addpeeraddress "tried", test addrman checks on restart with asmap
cdaab90662 Add test for addrman consistency check on restart with asmap (Jon Atack)
869f136816 Add test for rpc addpeeraddress with "tried" argument (Jon Atack)
ef242f5213 Allow passing "tried" to rpc addpeeraddress to call CAddrMan::Good() (Jon Atack)

Pull request description:

  This pull adds a `tried` argument to RPC addpeeraddress and a regression test for the recent addrman/asmap changes and issue.

  PR #22697 introduced a reproducible bug in commit 181a1207 that fails addrman consistency checks and causes it to significantly lose peer entries when the `-asmap` configuration option is used.

  The issue occurs upon bitcoind restart due to an initialization order change in `src/init.cpp` in that commit, whereby CAddrman asmap is set after deserializing `peers.dat`, rather than before.

  Issue reported on the `#bitcoin-core-dev` IRC channel starting at https://www.erisian.com.au/bitcoin-core-dev/log-2021-08-23.html#l-263.

  ```
  addrman lost 22813 new and 2 tried addresses due to collisions or invalid addresses
  ADDRMAN CONSISTENCY CHECK FAILED!!! err=-17 bitcoind: ./addrman.h:707: void CAddrMan::Check() const: Assertion `false' failed. Aborted
  ```

  How to reproduce:

  - `git checkout 181a1207`, build, and launch bitcoind with the `-asmap` and `-checkaddrman=1` configuration options enabled
  - restart bitcoind
  - bitcoind aborts on the second call to the addrman consistency checks in `CAddrMan::Check()`

  How to test this pull:

  - `git checkout 181a1207`, cherry pick the first commit of this branch, build, git checkout this branch, run `test/functional/rpc_net.py`, which should pass, and then run `test/functional/feature_asmap.py`, which should fail with the following output:

  ```
  AssertionError: Unexpected stderr bitcoind: ./addrman.h:739: void CAddrMan::Check() const: Assertion `false' failed.
  ```

ACKs for top commit:
  jnewbery:
    utACK cdaab90662
  mzumsande:
    re-ACK cdaab90662 (based on code review of diff to d586817)
  vasild:
    ACK cdaab90662

Tree-SHA512: 0251a18fea629b62486fc907d7ab0e96c6df6fadb9e4d62cff018bc681afb6ac31e0e7258809c0a88f91e4a36c4fb0b16ed294ce47ef30585217de89c3342399
2021-09-21 09:34:28 +02:00
merge-script
0c1a39390f
Merge bitcoin/bitcoin#23041: test: Add addrman deserialization error tests
faa81f9486 test: Add addrman deserialization error tests (MarcoFalke)

Pull request description:

  Add missing test coverage

ACKs for top commit:
  jonatack:
    Light code review ACK faa81f9486 and ran the test

Tree-SHA512: 8b254ba912c83473125faaf7df02a33a99840b40460bdce1486991a01de9ba6371c053354318f09b69fdc18c823bca3f2f7d341db0f8950e22d8435acbaa9cf5
2021-09-21 09:28:45 +02:00
merge-script
89447a63b9
Merge bitcoin/bitcoin#23017: test: Replace MiniWallet scan_blocks with rescan_utxos
fa7e3f1fc1 test: Replace MiniWallet scan_blocks with rescan_utxos (MarcoFalke)

Pull request description:

  This avoids having to fiddle with the `start` and `num` parameters and instead use the `scantxoutset` RPC functionality via `rescan_utxos`.

ACKs for top commit:
  Shubhankar-Gambhir:
    ACK fa7e3f1, all tests were succesfull
  theStack:
    re-ACK fa7e3f1fc1

Tree-SHA512: 6f47d2acac9f180b2b0f8f04797e74ecb1fc180f6b164c67813a3a1f97acea54baed74e5e0a3512e3babf76b105c09e1ba4cad818c83c7cb2beb7377b4c96954
2021-09-21 09:22:30 +02:00
merge-script
eb180d807a
Merge bitcoin/bitcoin#23050: log: change an incorrect fee to fee rate, and vice-versa
c17f554fcc Fix BlockAssembler::AddToBlock, CTxMemPool::PrioritiseTransaction logging (Jon Atack)

Pull request description:

  This is a tale of two fees, er, fee rates... indeed, one is misdescribed as a fee, and the other is incorrectly called a fee rate.

  From this review discussion: https://github.com/bitcoin/bitcoin/pull/22689#discussion_r695866211 (thanks to John Newbery).

ACKs for top commit:
  laanwj:
    Code review ACK c17f554fcc

Tree-SHA512: 3d9df3209a72562c5f9bbf815923d5b089d04491b8d19caa2c04158c501b47ef01e47f1c32d89adcbaf3c6357329507f65b4bb2963214c3451bbfa61ac812530
2021-09-21 09:18:01 +02:00
fanquake
1260b7e483
Merge bitcoin/bitcoin#23001: doc: Enable TLS in links in documentation
9bdda50151 Enable TLS in links in documentation (Jeremy Rand)

Pull request description:

  This PR enables TLS in several documentation links, which improves security.

ACKs for top commit:
  fanquake:
    ACK 9bdda50151

Tree-SHA512: 9d04d8771a9daf3c3b9914ff324e2eabfdf3ff5ae7f7dc92b84a1f3527010ceb860e73873a8f24d6051763eb472d9ea324ccbd6129a40318a520ca88c05f0586
2021-09-21 14:47:05 +08:00
merge-script
e4ae0008d8
Merge bitcoin/bitcoin#23014: ci: Bump distro version, disable feature_bind_extra for two configurations
fa660de2ac ci: Update valgrind config (MarcoFalke)
fad5dbc13c ci: Update s390x config (MarcoFalke)

Pull request description:

  (See commit messages)

ACKs for top commit:
  fanquake:
    ACK fa660de2ac

Tree-SHA512: b5bf7c89042d5d8f49a92c59b934185447ae42bd055ccb1c6edb98fe104a35eb2d6c26d810bec9f52d545d09599f3d33fc8606fbfb793862610d276b2a4bac6c
2021-09-21 08:42:08 +02:00
fanquake
133446f3dc
Merge bitcoin/bitcoin#23043: ci: Set --nocleanup for Windows functional tests
fac67b393b ci: Set --nocleanup for Windows functional tests (MarcoFalke)

Pull request description:

  Example: https://cirrus-ci.com/task/6292402450202624

ACKs for top commit:
  hebasto:
    ACK fac67b393b

Tree-SHA512: b8da82d1492f66b43e4afc525805a42709a7b13e64320681801e3e5b546da3d82933f5248464900620aa89eac4629f0b21cde623caf45950f1341979b47fa621
2021-09-21 11:45:46 +08:00
Jon Atack
c17f554fcc
Fix BlockAssembler::AddToBlock, CTxMemPool::PrioritiseTransaction logging 2021-09-20 22:40:15 +02:00
W. J. van der Laan
7f7bd3111c
Merge bitcoin/bitcoin#22974: addrman: Improve performance of Good
57ce20307e fuzz: allow lower number of sources (Martin Zumsande)
acf656d540 fuzz: Use public interface to fill addrman tried tables (Martin Zumsande)
eb2e113df1 addrman: Improve performance of Good (Martin Zumsande)

Pull request description:

  Currently, `CAddrman::Good()` is rather slow because the process of moving an addr from new to tried involves looping over the new tables twice:
  1) In `Good_()`, there is a loop searching for a new bucket the addr is currently in, but this information is never used except for aborting if it is not found anywhere (since [this commit](e6b343d880 (diff-49d1faa58beca1ee1509a247e0331bb91f8604e30a483a7b2dea813e6cea02e2R263)) it is no longer passed to `MakeTried`)
  This is unnecessary because in a non-corrupted addrman, an address that is not in New must be either in Tried or not at all in addrman, both cases in which we'd return early in `Good_()` and never get to this point.
  I removed this loop (and left a check for `nRefCount` as a belt-and-suspenders check).

  2) In `MakeTried()`, which is called from `Good_()`, another loop removes all instances of this address from new. This can be spedup by stopping the search at  `nRefCount==0`. Further reductions in `nRefCount` would only lead to an assert anyway.
  Moreover, the search can be started at the bucket determined by the source of the addr for which `Good` was called, so that if it is present just once in New, no further buckets need to be checked.

  While calls to `Good()` are not that frequent normally, the performance gain is clearly seen in the fuzz target `addman_serdeser`, where, because of the slowness in creating a decently filled addrman, a shortcut was created that would directly populate the tried tables by reaching into addrman's internals, bypassing `Good()` (#21129).
  I removed this workaround in the second commit: Using `Good()` is still slower by a factor of 2 (down from a factor of ~60 before), but I think that this compensated by the advantages of not having to reach into the internal structures of addrman  (see https://github.com/jnewbery/bitcoin/pull/18#issuecomment-775218676).

  [Edit]: For benchmark results see https://github.com/bitcoin/bitcoin/pull/22974#issuecomment-919435266 and https://github.com/bitcoin/bitcoin/pull/22974#issuecomment-920445700 - the benchmark `AddrManGood` shows a significant speedup by a factor >100.

ACKs for top commit:
  naumenkogs:
    ACK 57ce20307e
  jnewbery:
    ACK 57ce20307e
  laanwj:
    Code review ACK 57ce20307e
  theStack:
    ACK 57ce20307e
  vasild:
    ACK 57ce20307e

Tree-SHA512: fb6dfc198f2e28bdbb41cef9709828f22d83b4be0e640a3155ca42e771b6f58466de1468f54d773e794f780a79113f9f7d522032e87fdd75bdc4d99330445198
2021-09-20 19:47:55 +02:00
W. J. van der Laan
488e745560
Merge bitcoin/bitcoin#12677: RPC: Add ancestor{count,size,fees} to listunspent output
6cb60f3e6d doc/release-notes: Add new listunspent fields (Luke Dashjr)
0be2f17ef5 QA: Add tests for listunspent ancestor{count,size,fees} to mempool_packages (Luke Dashjr)
6966e80f45 RPC: Add ancestor{count,size,fees} to listunspent output (Luke Dashjr)
3f77dfdaf0 Expose ancestorsize and ancestorfees via getTransactionAncestry (Luke Dashjr)

Pull request description:

  Requested by a user

ACKs for top commit:
  prayank23:
    reACK 6cb60f3e6d
  fjahr:
    Code review re-ACK 6cb60f3e6d
  kiminuo:
    ACK [6cb60f3](6cb60f3e6d)
  achow101:
    Code Review ACK 6cb60f3e6d
  naumenkogs:
    ACK 6cb60f3e6d
  darosior:
    utACK 6cb60f3e6d

Tree-SHA512: 5d16e5799558691e5853ab7ea2cc85514cb45da3ce69134d855c71845beef32ec6af5ab28d4462683e9800c8ea126f162773a9d3d5660edac08fd8edbfeda173
2021-09-20 19:25:43 +02:00
W. J. van der Laan
d809d8bf12
Merge bitcoin/bitcoin#22959: cli: Display all proxies in -getinfo
7c3712fa32 cli: Display all proxies in -getinfo (klementtan)

Pull request description:

  **Changes**: Display all proxies in `-getinfo`

  **Motivation**:

  * Currently `-getinfo` only return the proxy of the first network in `getnetworkinfo`.
  * This PR will display all unique proxies in `getnetworkinfo` as suggested in https://github.com/bitcoin/bitcoin/issues/17314#issue-514543978
       >List all proxies, at least if they're different from the IPv4 one

  ![image](https://user-images.githubusercontent.com/49265907/133991832-a1f38b36-2975-4ce2-a427-e4ffab23383e.png)

  **Testing**:

  You can verify this change by starting bitcoind with
  ```shell
  ./src/bitcoind -signet --proxy=127.0.0.1:9050 --i2psam=127.0.0.1:7656
  ```

  Execute `-getinfo`
  ```shell
  ./src/bitcoin-cli -signet -getinfo
  ```

ACKs for top commit:
  laanwj:
    Tested ACK 7c3712fa32
  prayank23:
    utACK 7c3712fa32

Tree-SHA512: 9eae97866220227f30ca4585f52799fa66fc1135047d869c4aabe598aee1a9414cb9e1c4a8d19165e52d65005f3c6d4bcc37463ace0ddb44389dfbcd4ca74095
2021-09-20 17:48:31 +02:00
klementtan
7c3712fa32
cli: Display all proxies in -getinfo 2021-09-20 18:52:04 +08:00
MarcoFalke
fac67b393b
ci: Set --nocleanup for Windows functional tests
This avoids intermittent issues in the CI Task when a test passes
successfully. For example:

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp\\test_runner_₿_🏃_20210920_072037\\feature_versionbits_warning_89\\alert.txt'
2021-09-20 09:41:41 +02:00
MarcoFalke
faa81f9486
test: Add addrman deserialization error tests 2021-09-20 09:07:44 +02:00
MarcoFalke
fa7e3f1fc1
test: Replace MiniWallet scan_blocks with rescan_utxos 2021-09-20 08:31:04 +02:00
merge-script
226731ac11
Merge bitcoin/bitcoin#23037: test: fix confusing off-by-one nValue in feature_coinstatsindex.py
ebe49b5b7c test: fix confusing off-by-one nValue in feature_coinstatsindex.py (Sebastian Falbesoner)

Pull request description:

  Due to evil floating-point arithmetic, the creation of one of the transaction outputs in feature_coinstatsindex.py leads to it's nValue being off by one satoshi: the Python expression `int(21.99 * COIN)` doesn't yield 2199000000 as expected, but 2198999999.

  This makes the test more confusing than necessary (w.r.t. the expected `gettxoutsetinfo` values), and could also cause problems if the value is ever changed. Fix by using a `Decimal` type for specifying the value in BTC, rather than using a bare floating-point.

ACKs for top commit:
  MarcoFalke:
    cr ACK ebe49b5b7c

Tree-SHA512: c74c51dbf99818f3d1c881873e0c053a649e4fed9b36767ff971dd3a48bff7122afea4e07cc9925236570368b45579f63e443701f2aaef838a0fafdbe986dfd4
2021-09-20 07:59:49 +02:00
fanquake
2560b6862b
Merge bitcoin/bitcoin#23007: doc: remove WSL install instructions and point to upstream
f58f697c98 doc: remove WSL install instructions and point to upstream (fanquake)

Pull request description:

  There's not really any need for us to have to replicate (ever-changing) instructions for installing an operating system in our build documentation.

ACKs for top commit:
  laanwj:
    ACK f58f697c98
  hebasto:
    ACK f58f697c98

Tree-SHA512: 3ca90cf7696909503ca500756c718f019c410b1e24c139e7e9fdc8726d1c37a7b6c869fdac1cb7ab8c8065bc49c808778ca5985f54d4a698c162866d00397d48
2021-09-20 11:43:28 +08:00
Sebastian Falbesoner
ebe49b5b7c test: fix confusing off-by-one nValue in feature_coinstatsindex.py
Due to evil floating-point arithmetic, the creation of one of the
transaction outputs in feature_coinstatsindex.py leads to it's nValue
being off by one satoshi: the Python expression `int(21.99 * COIN)`
doesn't yield 2199000000 as expected, but 2198999999.

This makes the test more confusing than necessary (w.r.t. the expected
`gettxoutsetinfo` values), and could also cause problems if the value
is ever changed. Fix by using a `Decimal` type for specifying the
value in BTC, rather than using a bare floating-point.
2021-09-19 21:23:24 +02:00
fanquake
de2af19dc8
Merge bitcoin/bitcoin#22987: qa: Fix "RuntimeError: Event loop is closed" on Windows
357f0c7233 ci: Enable more functional tests on Windows MSVC task (Hennadii Stepanov)
f55932678f qa: Fix "RuntimeError: Event loop is closed" on Windows (Hennadii Stepanov)

Pull request description:

  On master (2161a05855), running functional tests that use the P2P interface ends with an error:
  ```
  RuntimeError: Event loop is closed
  ```

  This PR fixes this bug, and enables more functional tests on Windows MSVC CI task.

  More details about bugfix:
  - [What’s New In Python 3.7](https://docs.python.org/3/whatsnew/3.7.html#asyncio)
  - https://bugs.python.org/issue33792
  - actual [change](https://docs.python.org/3.8/library/asyncio-policy.html#asyncio.WindowsSelectorEventLoopPolicy) done in Python 3.8

  Excluded tests, that are listed in the `EXCLUDE_TESTS` environment variable, need more thorough investigation to be enabled.

ACKs for top commit:
  MarcoFalke:
    review ACK 357f0c7233 🌆

Tree-SHA512: d0ba85be81d55c934959ce7402a9c726598125e9751a1de179d16759d0e8b8a915de879c3a62c12d3564c5e0d9649ebd86963744449626efaa42d9eaa99ad3d0
2021-09-18 16:49:19 +08:00
merge-script
e69cbac628
Merge bitcoin/bitcoin#22896: refactor: net: avoid duplicate map lookups to mapLocalHost
330d3aa1a2 refactor: net: avoid duplicate map lookups to `mapLocalHost` (Sebastian Falbesoner)

Pull request description:

  This simple refactoring PR aims to avoid duplicate lookups to `mapLocalHost`: instead of calling `count()` (to first find out whether a key is in the map) and then `operator[]` (to get the value to the passed key, or default-construct one if not found), use either
  * `find()` and dereference the returned iterator (for simple lookups), see https://www.cplusplus.com/reference/map/map/find/
  * `emplace()` and use the returned <iterator, inserted> pair (for lookups where a new element should be inserted if the key isn't found), see https://www.cplusplus.com/reference/map/map/emplace/

ACKs for top commit:
  naumenkogs:
    ACK 330d3aa1a2
  jonatack:
    Code review ACK 330d3aa1a2 plus rebase to master + debug build

Tree-SHA512: d13da6a927ff561eee8ac6b093bf3586dfe31d6c94173a5a6d8f3698e0ee224fb394d3635155d5141c165da59d2c2c37260122eb4f2e8bcda3e8a29b901d213e
2021-09-17 14:25:10 +02:00
MarcoFalke
fa660de2ac
ci: Update valgrind config
* Set missing DOCKER_NAME_TAG
* Update TEST_RUNNER_EXTRA
2021-09-17 12:54:48 +02:00
MarcoFalke
fad5dbc13c
ci: Update s390x config
* Bump to debian:bookworm to avoid crash in the zmq functional test
  (bitcoind: line 2: 33011 Illegal instruction     (core dumped)
  qemu-s390x)
* Remove RUN_UNIT_TESTS=true, because it is the default
* Add TEST_RUNNER_EXTRA --exclude to skip failing tests
2021-09-17 12:47:32 +02:00
merge-script
6401de0133
Merge bitcoin/bitcoin#22226: doc: add unittest core dump instructions
12313382e6 doc: test: unittest segfault gdb (James O'Beirne)

Pull request description:

  Quick note on how to get core dumps out of the unittests.

ACKs for top commit:
  theStack:
    ACK 12313382e6

Tree-SHA512: d749d9117f96af85f9053884c57df766ac1d29e57b2555d4fc63bd9dc29df47487954cee1c7cd78ee420ae1c9c7da7ddc9797b6c636ce7641eae20622eaa3fee
2021-09-17 08:17:38 +02:00
fanquake
f58f697c98
doc: remove WSL install instructions and point to upstream
There's not really any need to us to have to replicate (ever-changing)
instructions for installing an operating system in our build
documentation.
2021-09-17 11:24:55 +08:00
fanquake
f7189c4ce9
Merge bitcoin/bitcoin#22941: wallet: refactor: inline functions {Read,Write}OrderPos
98cf19ca32 wallet: refactor: avoid duplicate lookup on `mapValue["timesmart"]` (Sebastian Falbesoner)
973d8ba93d wallet: refactor: inline function WriteOrderPos() (Sebastian Falbesoner)
65ed198295 wallet: refactor: inline function ReadOrderPos() (Sebastian Falbesoner)

Pull request description:

  The functions `ReadOrderPos` and `WriteOrderPos` have been introduced in commit 9c7722b7c5 in 2012. Since accounts have been removed in #13825 (commit c9c32e6b84), they are only called at one place in `CWalletTx::{Serialize,Unserialize}` and thus can be directly inlined instead. Additionally, this PR aims to avoids duplicate lookups on the map `mapValue` (affects keys "n" and "timesmart").

ACKs for top commit:
  laanwj:
    Code review ACK 98cf19ca32
  achow101:
    Code Review ACK 98cf19ca32

Tree-SHA512: 8af63c174c79e589bd713f04e8e40caba9f93ec2978c805427cac50d48049808a8c23ff5eea9ef589c9bd79fc66087f43ff5ab28e3cda51dd03f37c0164e2e4c
2021-09-17 10:36:44 +08:00
James O'Beirne
12313382e6
doc: test: unittest segfault gdb
Feedback from Jon Atack and Marco Falke.
2021-09-16 18:02:55 -04:00
Jeremy Rand
9bdda50151
Enable TLS in links in documentation 2021-09-16 22:00:20 +00:00
Luke Dashjr
6cb60f3e6d doc/release-notes: Add new listunspent fields 2021-09-16 20:34:49 +00:00
Luke Dashjr
0be2f17ef5 QA: Add tests for listunspent ancestor{count,size,fees} to mempool_packages 2021-09-16 20:34:49 +00:00
Luke Dashjr
6966e80f45 RPC: Add ancestor{count,size,fees} to listunspent output 2021-09-16 20:34:49 +00:00
W. J. van der Laan
6ef84e0503
Merge bitcoin/bitcoin#22420: doc: Specifiy how to set the value of TORGROUP
5984084610 Specifies how to set the value of TORGROUP (lsilva01)

Pull request description:

  This change just makes it more explicit how to assign the value to the TORGROUP variable.

ACKs for top commit:
  laanwj:
    ACK 5984084610
  Zero-1729:
    Concept ACK 5984084610

Tree-SHA512: af5cc0f87fa309201b5937a2741dea9374eafc09e84664ca138669c1827ce44fe6d25e3853d53ed2c838321aa4b28c6fd9d8dbe23f7194fdd6559d49453416e4
2021-09-16 20:17:01 +02:00
W. J. van der Laan
82a85216c3
Merge bitcoin/bitcoin#22845: build: improve check for ::(w)system
3ec633ef1a build: improve check for ::(w)system (fanquake)

Pull request description:

  `AC_DEFINE()` takes `HAVE_STD__SYSTEM || HAVE_WSYSTEM` literally, meaning you
  end up with the following in bitcoin-config.h:
  ```cpp
  /* std::system or ::wsystem */
  #define HAVE_SYSTEM HAVE_STD__SYSTEM || HAVE_WSYSTEM
  ```

  This works for the preprocessor, because `HAVE_SYSTEM`, is defined, just unusually. Remove this in favor of setting `have_any_system` in either case, given we don't actually use `HAVE_STD__SYSTEM` or `HAVE_WSYSTEM`, and defining `HAVE_SYSTEM` to 1 thereafter.

ACKs for top commit:
  laanwj:
    Code review ACK 3ec633ef1a

Tree-SHA512: 02c39ba3179136ec1dc28df026b7fa5d732914c85622298ba7ec880f1ae9324208d322a47be451a5c2ff2e165ad1d446bae92e7018db8e517e7ac38fca25a0a3
2021-09-16 20:09:37 +02:00
W. J. van der Laan
71bdf0bff1
Merge bitcoin/bitcoin#22626: Remove txindex migration code
fa20f815a9 Remove txindex migration code (MarcoFalke)
fae8786033 doc: Fix validation typo (MarcoFalke)
fab89006d6 Add missing includes and forward declarations, remove unused ones (MarcoFalke)

Pull request description:

  No supported version of Bitcoin Core used the legacy txindex, so all relevant nodes can be assumed to have upgraded. Thus, there is no need to keep this code any longer.

  As a temporary courtesy, provide a one-time warning on how to free the disk space used by the legacy txindex.

  Fixes #22615

ACKs for top commit:
  laanwj:
    Code review ACK fa20f815a9
  hebasto:
    ACK fa20f815a9, tested on Linux Mint 20.2 (x86_64).
  Zero-1729:
    crACK fa20f815a9
  theStack:
    Approach ACK fa20f815a9

Tree-SHA512: 68aa32d064d1e3932e6e382816a4b5de417bd7e82861fea1ee50660e8c397f4efeb88ae4ed54a8ad1952c3563eb0b8449d7ccf883c353cc4d4dc7e15c53d78e8
2021-09-16 19:53:28 +02:00
W. J. van der Laan
698b4b8fac
Merge bitcoin/bitcoin#22930: build: remove glibc back compat
76630cbfb9 doc: add glibc to dependencies.md (fanquake)
a907704e7f compat: remove glibc_compat.cpp (fanquake)
62e45da945 build: remove glibc-back-compat from build system (fanquake)
2ef0accefc remove --enable-glibc-back-compat from CI and docs (fanquake)

Pull request description:

  This removes our glibc backwards compatibility code (glibcxx sanity checks remain), which is [no-longer used for release builds](https://github.com/bitcoin/bitcoin/pull/22405).

  With these changes our minimum required glibc remains at 2.17, as Guix builds [are done with `--disable-thread-local`](d2dd1697ce/contrib/guix/libexec/build.sh (L242)).

  Guix builds:
  ```bash
  d9024376ac06b836800b942fcbe8a6454866ded652e41c43d605255f840e8183  guix-build-76630cbfb924/output/aarch64-linux-gnu/SHA256SUMS.part
  bea9607f111b7a501e2410e59ccfca6f83ea075edb299d2f9b878860a4f1ad50  guix-build-76630cbfb924/output/aarch64-linux-gnu/bitcoin-76630cbfb924-aarch64-linux-gnu-debug.tar.gz
  b41d7eaec5b598f146ead32a40c0e2281d22138c02a7000fb154fe8ff341ab9d  guix-build-76630cbfb924/output/aarch64-linux-gnu/bitcoin-76630cbfb924-aarch64-linux-gnu.tar.gz
  9ec0e1b2cd4ca55d5c12354325d7c4552333f1bad7e620db247eb24e15500210  guix-build-76630cbfb924/output/arm-linux-gnueabihf/SHA256SUMS.part
  dbb3e92a3b7d6460e0d5319f49c91eb65593d8604807c1b3084c9d657b198271  guix-build-76630cbfb924/output/arm-linux-gnueabihf/bitcoin-76630cbfb924-arm-linux-gnueabihf-debug.tar.gz
  ff2fa70b01f92b9fba9f0216deebc3e511d84ff93a7316f6766a405160a20483  guix-build-76630cbfb924/output/arm-linux-gnueabihf/bitcoin-76630cbfb924-arm-linux-gnueabihf.tar.gz
  486586b4f3e81855a52e5410127b92f6dde9d1eede2720de260b13552a4b4823  guix-build-76630cbfb924/output/dist-archive/bitcoin-76630cbfb924.tar.gz
  466ccc848c39c0ca85c4575c2bfcd1bc7aba2caa5ba8a42147cce60be5120bf6  guix-build-76630cbfb924/output/powerpc64-linux-gnu/SHA256SUMS.part
  4c739da127df3738e993dcef48ec8f005b7d7938060197c718e771cdd18c2087  guix-build-76630cbfb924/output/powerpc64-linux-gnu/bitcoin-76630cbfb924-powerpc64-linux-gnu-debug.tar.gz
  2294fc23c170d63fc03085d56ba8653e3cf0cff15c8bd5680faa7b7552e1db07  guix-build-76630cbfb924/output/powerpc64-linux-gnu/bitcoin-76630cbfb924-powerpc64-linux-gnu.tar.gz
  7be025478c51a1ba7884a7c2f090a1311651fc218d706051b1830cbc4e82ee4d  guix-build-76630cbfb924/output/powerpc64le-linux-gnu/SHA256SUMS.part
  30600ad6d9bfe70b68a2a4bedc733b56b26232a45d4491b1a6fa30b76cd3f690  guix-build-76630cbfb924/output/powerpc64le-linux-gnu/bitcoin-76630cbfb924-powerpc64le-linux-gnu-debug.tar.gz
  70528805fae16b95d1df46011511ca1c2616fb89422c0164e30d02fa0193b6a1  guix-build-76630cbfb924/output/powerpc64le-linux-gnu/bitcoin-76630cbfb924-powerpc64le-linux-gnu.tar.gz
  20f4daaa095803e9c34ed8b119f948e3e61d03b4d5814e4b15ca285c2ba5a109  guix-build-76630cbfb924/output/riscv64-linux-gnu/SHA256SUMS.part
  6f969d6b6561ea87d1e54a3a643640da54e4e33d2470dbc607ad27f3a87a0f1d  guix-build-76630cbfb924/output/riscv64-linux-gnu/bitcoin-76630cbfb924-riscv64-linux-gnu-debug.tar.gz
  7c1e925d199d21781c96e9ee8d63d5eac995cbe2574ccedd81c0938531f694c1  guix-build-76630cbfb924/output/riscv64-linux-gnu/bitcoin-76630cbfb924-riscv64-linux-gnu.tar.gz
  d0f13a7a9fcd95669cbab3b637940c2014632405037959989768ec2ffa7fd861  guix-build-76630cbfb924/output/x86_64-apple-darwin18/SHA256SUMS.part
  ff23fbdd72fd42140bf11773866061cd5571b66d65bbd769b1345969d195b7ce  guix-build-76630cbfb924/output/x86_64-apple-darwin18/bitcoin-76630cbfb924-osx-unsigned.dmg
  1b51f4a7611b85d4f599291f42887643ddd59babfc6fb71284793123d8a6be33  guix-build-76630cbfb924/output/x86_64-apple-darwin18/bitcoin-76630cbfb924-osx-unsigned.tar.gz
  e0dc9be66c3dc9ba30c5224cf0499ef02b3b7e213081561a6d57d5cc76b3e9a7  guix-build-76630cbfb924/output/x86_64-apple-darwin18/bitcoin-76630cbfb924-osx64.tar.gz
  ae3fb0320a0f39dae48354fe74f3d071b16b33920b3b7b27244658439fdfbc93  guix-build-76630cbfb924/output/x86_64-linux-gnu/SHA256SUMS.part
  9545ccf26a930a3f876058bb0c4965e1320a354ee2d9ce27d95f8bdd2e8679a6  guix-build-76630cbfb924/output/x86_64-linux-gnu/bitcoin-76630cbfb924-x86_64-linux-gnu-debug.tar.gz
  4827206220eaa2b36ebb44b68035c6bda0cec0c2f1b27c08b8349f2f7b3f56d5  guix-build-76630cbfb924/output/x86_64-linux-gnu/bitcoin-76630cbfb924-x86_64-linux-gnu.tar.gz
  c2ad3ed62b2ac41a25a43e1c38869a588bf93853cae4502880adf0b66ce30369  guix-build-76630cbfb924/output/x86_64-w64-mingw32/SHA256SUMS.part
  a88ee3a0cb715d32cf12cb164d8fe4d9c4c810cc417426f3aacc4e7f08460271  guix-build-76630cbfb924/output/x86_64-w64-mingw32/bitcoin-76630cbfb924-win-unsigned.tar.gz
  7673ac8df641d185ea7a150ed27eeee9645168e126d186c6ae935eefdff9edae  guix-build-76630cbfb924/output/x86_64-w64-mingw32/bitcoin-76630cbfb924-win64-debug.zip
  b90d243d292d1b603d744639e5061917035bd8fba6acd0bb61f10479a200f5aa  guix-build-76630cbfb924/output/x86_64-w64-mingw32/bitcoin-76630cbfb924-win64-setup-unsigned.exe
  fe69d000da647e0fb7ab19252149be4b45af742223b4c37630200b1d5b43de33  guix-build-76630cbfb924/output/x86_64-w64-mingw32/bitcoin-76630cbfb924-win64.zip
  ```

ACKs for top commit:
  laanwj:
    Code review ACK 76630cbfb9

Tree-SHA512: 6bd1e344f0f37cfb0017fb8b2b0eee41c6a043f23f8ccb2ad1d59e7f2a47f4b84fe431d7d059c409b63263a0af38be955961c4b2ba7b03538f77a0597abb7880
2021-09-16 19:03:42 +02:00
W. J. van der Laan
0de84b7328
Merge bitcoin/bitcoin#22544: cli -addrinfo: drop torv2; torv3 becomes onion per GetNetworkName()
49d503aefa doc: update -addrinfo in release-notes.md and tor.md (Jon Atack)
75ea9ecf11 cli -addrinfo: drop torv2, torv3 becomes onion per GetNetworkName() (Jon Atack)

Pull request description:

  #22050 removed torv2 support from 22.0. For 23.0 and subsequent releases, we can probably remove torv2 from -addrinfo.

  before
  ```
    "addresses_known": {
      "ipv4": 58305,
      "ipv6": 5138,
      "torv2": 0,
      "torv3": 5441,
      "i2p": 14,
      "total": 68898
    }
  ```
  after
  ```
    "addresses_known": {
      "ipv4": 58305,
      "ipv6": 5138,
      "onion": 5441,
      "i2p": 14,
      "total": 68898
    }
  ```
  Per the naming of `netbase.{h, cpp}::GetNetworkName()`, torv3 becomes onion, which is what is printed in the output of getpeerinfo, getnetworkinfo and getnodeaddresses.

ACKs for top commit:
  practicalswift:
    cr ACK 49d503aefa
  Zero-1729:
    tACK 49d503aefa 🧉
  klementtan:
    Code review and tested ACK 49d503aefa

Tree-SHA512: bca52520d8b12c26f1c329d661b9e22c567954ed2af7d2a16d7669eae1a221eada20944f8b2f4e78e31a7190d5f3d3fbfd37509e5edf2d9a3747a0a8f4e375bb
2021-09-16 18:44:20 +02:00
W. J. van der Laan
cdf12c7b3d
Merge bitcoin/bitcoin#22895: consensus: don't call GetBlockPos in ReadBlockFromDisk without cs_main lock
350e034e64 consensus: don't call GetBlockPos in ReadBlockFromDisk without lock (Jon Atack)

Pull request description:

  Commit ccd8ef65 "Reduce cs_main lock in ReadBlockFromDisk, only read GetBlockPos under the lock" in #11281 moved the cs_main lock from caller to `ReadBlockFromDisk()` for calling `CBlockIndex::GetBlockPos()`, but the second invocation doesn't have the lock, and IIUC there is no guarantee the compiler can know if state has changed.

  Use the `blockPos` local variable instead, rename it to `block_pos`, and make it const.

ACKs for top commit:
  laanwj:
    Code review ACK 350e034e64
  theStack:
    Code-review ACK 350e034e64
  promag:
    Code review ACK 350e034e64.

Tree-SHA512: 0df0614ab1876885c85f7b53c604a759a29008da8027e95503b4726d2b820ec6d27546020c613337ff954406e01cb5d191978ba4a12124052fed6e1b0e9a226f
2021-09-16 17:00:54 +02:00
Sebastian Falbesoner
f680d27155 test: use MiniWallet for make_utxo helper in feature_rbf.py 2021-09-16 16:48:55 +02:00
W. J. van der Laan
58e02395ba
Merge bitcoin/bitcoin#22955: p2p: Rename fBlocksOnly, Add test
fa66a7d732 p2p: Rename fBlocksOnly, Add test (MarcoFalke)
fac66d0a39 test: Simplify p2p_blocksonly test with new miniwallet rescan_utxos method (MarcoFalke)

Pull request description:

  `fBlocksOnly` has several issues:
  * The name is confusing
  * It is untested

  Fix both.

ACKs for top commit:
  laanwj:
    Code review ACK fa66a7d732

Tree-SHA512: 4218f455eeb37297f74603d7d44895288605844ae828a40dfb7a70215f1a058ac5ad945a22732f5ebcad3ad375d54ba360bea69ea79639a30d4c88b042448f0f
2021-09-16 16:38:14 +02:00
W. J. van der Laan
6d76b57ca0
Merge bitcoin/bitcoin#22960: test: Set peertimeout in write_config
fad4f44645 test: Set peertimeout in write_config (MarcoFalke)

Pull request description:

  This avoids having to remember to set it whenever mocktime is used with
  peer connections. Also, it might help avoiding disconnects when
  attaching a debugger to a running test.

ACKs for top commit:
  laanwj:
    Concept and code review ACK fad4f44645

Tree-SHA512: 00c742571c0524c1b3f55e0217433ef7aa2dccccc12650caab98b4cf9231669f37fc589c7475f28d5725ffe2436c76205920eaece4a47fd27dc8872421a48e5c
2021-09-16 16:00:41 +02:00
W. J. van der Laan
7a999879d2
Merge bitcoin/bitcoin#22995: doc: Remove stale comment for CPrivKey
5008dd87b2 doc: Remove stale comment for CPrivKey (Calvin Kim)

Pull request description:

  Removes stale doc about `secure_allocator` being defined in `allocators.h`.

ACKs for top commit:
  laanwj:
    ACK 5008dd87b2
  theStack:
    Code-review ACK 5008dd87b2

Tree-SHA512: eb65aff6db5b27d0db2b86f1d1dc6e066daccdaf00f7f9f95b5bee507167fcea2601316cdbd70da4ba32f1fab1e28e440a7e3cabd7b1a72c07dd20b1367361f0
2021-09-16 15:15:36 +02:00
Sebastian Falbesoner
0f27524602 test: scale amounts in test_doublespend_tree down by factor 10
This is done in order to prepare the make_utxo helper to use MiniWallet,
which only supports creating transactions with single inputs, i.e. we
need to create amounts small enough to be funded by coinbase transactions
(50 BTC).
2021-09-16 14:32:43 +02:00
Sebastian Falbesoner
d1e2481274 test: scale amounts in test_doublespend_chain down by factor 10
This is done in order to prepare the make_utxo helper to use MiniWallet,
which only supports creating transactions with single inputs, i.e. we
need to create amounts small enough to be funded by coinbase transactions
(50 BTC).
2021-09-16 14:22:39 +02:00
Calvin Kim
5008dd87b2 doc: Remove stale comment for CPrivKey 2021-09-16 21:16:39 +09:00