Commit Graph

24296 Commits

Author SHA1 Message Date
fanquake
2680860707
Merge #21728: remove executable flag for src/net_processing.cpp
f2f2541ee7ad36191515ff351b667fe12a2ab871 remove executable flag for src/net_processing.cpp (Sebastian Falbesoner)

Pull request description:

  The file permissions for `src/net_processing.cpp` have been changed in #21713, as discovered by fanquake (https://github.com/bitcoin/bitcoin/pull/21713#issuecomment-822245960). This PR removes the executable flag again.

ACKs for top commit:
  kiminuo:
    ACK f2f2541ee7ad36191515ff351b667fe12a2ab871 :)
  jnewbery:
    ACK f2f2541ee7ad36191515ff351b667fe12a2ab871
  promag:
    ACK f2f2541ee7ad36191515ff351b667fe12a2ab871.

Tree-SHA512: 1d5a62afb1152029e69fccea2ae53dcb262a91724a5c03dfc4de8c409b280814d0c211c2f9a71f1a6e927f4ed571ba4ac311de9de8ebb797eaf1051674241bdb
2023-12-03 20:44:58 -06:00
MarcoFalke
1b130dec1c
Merge bitcoin-core/gui#277: Do not use QClipboard::Selection on Windows and macOS.
7f3a5980c1d54988a707b961fd2ef647cebb4c5b qt: Do not use QClipboard::Selection on Windows and macOS. (Hennadii Stepanov)

Pull request description:

  Windows and macOS do [not support](https://doc.qt.io/qt-5/qclipboard.html#notes-for-windows-and-macos-users) the global mouse selection.

  Fixes #258.

ACKs for top commit:
  promag:
    Code review ACK 7f3a5980c1d54988a707b961fd2ef647cebb4c5b.
  jarolrod:
    ACK 7f3a5980c1d54988a707b961fd2ef647cebb4c5b

Tree-SHA512: be2beeef7d25af6f4d4a4548325d8d29f08e4342f499666bc4a670ed468a63195d514077c2cd0dba197e12bd43316fd3e2813cdc0954364b6aa4ae6b90c118bf
2023-12-03 20:44:58 -06:00
MarcoFalke
fb542454df
Merge #21477: test: Add test for CNetAddr::ToString IPv6 address formatting (RFC 5952)
732c7bddeb9cd4e9fe80ebb7ee98d0f9fcc6a9d3 tests: Add test for CNetAddr::ToString IPv6 address formatting (RFC 5952) (practicalswift)

Pull request description:

  Test that `CNetAddr::ToString` formats IPv6 addresses with zero compression and canonicalisation as described in [RFC 5952 ("A Recommendation for IPv6 Address Text Representation")](https://tools.ietf.org/html/rfc5952).

  Solving #21466 will hopefully be trivial with the ability to check zero compression correctness against these tests.

ACKs for top commit:
  vasild:
    ACK 732c7bddeb9cd4e9fe80ebb7ee98d0f9fcc6a9d3

Tree-SHA512: 31a1378aa435ba4171490a2e15d7280a175292270eb001b47d367e010c6ac9b83420b82bbeab22211f8f500c69e21878047c87adf216263b3420b6bb2a5d2bfb
2023-12-03 20:44:57 -06:00
MarcoFalke
d24bd4df90
Merge #21487: fuzz: Use ConsumeWeakEnum in addrman for service flags
55554463c15e3c75a64d26209dd3f8396e508cc2 fuzz: Use ConsumeWeakEnum in addrman for service flags (MarcoFalke)

Pull request description:

  This has minimally better performance. Reported by me in https://github.com/bitcoin/bitcoin/pull/20228#discussion_r598081787

ACKs for top commit:
  practicalswift:
    Tested ACK 55554463c15e3c75a64d26209dd3f8396e508cc2
  vasild:
    ACK 55554463c15e3c75a64d26209dd3f8396e508cc2

Tree-SHA512: 4e5f51fe4f2bd7b2f37d0690e41203341ba45c0c9bc9247449cd26cfb5f77dc2ec61df3e4963276f68694e4b3ca3d0a76367a51c4d775501edeb3224d305a261
2023-12-03 20:44:57 -06:00
MarcoFalke
01e39a311d
Merge bitcoin-core/gui#233: qt test: Don't bind to regtest port
e21276a82a9996c73e43990ccf927397f71399ea qt test: Don't bind to regtest port (Andrew Chow)

Pull request description:

  The qt tests don't need to bind to the regtest port. By not binding, it will no longer conflict with existing regtest instances and the tests will run as normal.

  Fixes #10

ACKs for top commit:
  MarcoFalke:
    cr ACK e21276a82a9996c73e43990ccf927397f71399ea
  jarolrod:
    re-ACK e21276a82a9996c73e43990ccf927397f71399ea, tested on macOS 11.2

Tree-SHA512: 5a269ee043f9aff7900e092c166de71912a2bf86ebe2982b3fb0e26bdebfb91869ee5d0f62082fd608c1288bfb7981f6c8647e504b11176711d7fec993a09164
2023-12-03 20:44:57 -06:00
MarcoFalke
c0cdac88a2
Merge #21334: test: Additional (refactored) BIP9 tests
0c471a5f306044cbd2eb230714571f05dd6aaf3c tests: check never active versionbits (Anthony Towns)
3ba9283a47ac358168db9db7840ae559f443486c tests: more helpful errors for failing versionbits tests (Anthony Towns)

Pull request description:

  Extracted from #19573 to make review easier. I also reviewed it myself.

  I added some comments to the test: bae9a45219 (r585486781)

  I also moved some `TestState` changes from the second to the first commit, to reduce the latter diff.

ACKs for top commit:
  ajtowns:
    ACK 0c471a5f306044cbd2eb230714571f05dd6aaf3c
  MarcoFalke:
    review ACK 0c471a5f306044cbd2eb230714571f05dd6aaf3c 🔓

Tree-SHA512: 61f8d1ecaf38a6cd13db1cf71c89b8c4d2f5852ef77c5e7ecb9bd78eb216545037411641bb101cf0740c5c47845ac327954ee25b676d63779c5f148719ac5caf
2023-12-03 20:44:56 -06:00
fanquake
ee1aff1cda
Merge #21358: fuzz: Add missing include (test/util/setup_common.h)
fa59ad5130d732027d01b8aac04b88326b81ac5b fuzz: Add missing include (test/util/setup_common.h) (MarcoFalke)

Pull request description:

  `src/test/fuzz/socks5.cpp` is using the symbol `BasicTestingSetup`, which is defined in `src/test/util/setup_common.h`.

  Currently compilation happens to succeed because the needed dependency is indirectly included. Compilation will break as soon as the indirect dependency is broken. According to the dev notes, everything that is used must be included.

  Fix the issue by including the missing include.

ACKs for top commit:
  fanquake:
    ACK fa59ad5130d732027d01b8aac04b88326b81ac5b

Tree-SHA512: 9359d5d288ebc5a53d753ebed1ee8d49ddcfe12aeb56054ea43654c0d915337bb0dce7c8a7178e94711ff8dacd1b3ea0a2871b21b1709cd9786efc0c1ef532b3
2023-12-03 20:44:56 -06:00
Wladimir J. van der Laan
8f212e047d
Merge #21250: build: make HAVE_O_CLOEXEC available outside LevelDB (bugfix)
9bac71350d98580cc7441957fc7c3fa2f4158553 build: make HAVE_O_CLOEXEC available outside LevelDB (bugfix) (Sebastian Falbesoner)
584fd91d2d294883e6896dbd64a2176528e94581 init: only use pipe2 if availabile, check in configure (Sebastian Falbesoner)

Pull request description:

  The result of the O_CLOEXEC availability check is currently only set in the Makefile and passed to LevelDB (see `LEVELDB_CPPFLAGS_INT` in `src/Makefile.leveldb.include`), but not defined to be used in our codebase. This means that code within the preprocessor conditional `#if HAVE_O_CLOEXEC` was actually never compiled. On the master branch this is currently used for pipe creation in `src/shutdown.cpp`, PR #21007 moves this part to a new module (I found the issue while testing that PR).

  The fix is similar to the one in #19803, which solved the same problem for HAVE_FDATASYNC.

  In the course of working on the PR it turned out that pipe2 is not available an all platforms, hence a configure check and a corresponding define HAVE_PIPE2 is introduced and used.

  The PR can be tested by anyone with a system that has pipe2 and O_CLOEXEC available by putting gibberish into the HAVE_O_CLOEXEC block: on master, everything should compile fine, on PR, the compiler should abort with an error. At least that's my naive way of testing preprocessor logic, happy to hear more sophisticated ways :-)

ACKs for top commit:
  laanwj:
    Code review ACK 9bac71350d98580cc7441957fc7c3fa2f4158553

Tree-SHA512: aec89faf6ba52b6f014c610ebef7b725d9e967207d58b42a4a71afc9f1268fcb673ecc85b33a2a3debba8105a304dd7edaba4208c5373fcef2ab83e48a170051
2023-12-03 20:44:56 -06:00
Wladimir J. van der Laan
617f41036f
Merge #21041: log: Move "Pre-allocating up to position 0x[…] in […].dat" log message to debug category
25f899cc23a791c08e19acae91bebda6c3538d37 log: Move "Pre-allocating up to position 0x[...] in [...].dat" log message to debug category (practicalswift)
acd7980b37b5a71f324f7772d72175c8bd7ab900 log: Move "Leaving block file [...]: [...]" log message to debug category (practicalswift)

Pull request description:

  Move `Pre-allocating up to position 0x[…] in […].dat` log message to debug category.

  After the cleanup of `-debug=net` log messages PR (#20724) was merged recently the console log now has very high signal to noise ratio. That's great! :)

  This PR increases the signal to noise ratio slightly more by moving the most common remaining implementation detail log message (`Pre-allocating up to position 0x[…] in […].dat`) to the debug category where it belongs :)

  Expected standard output from `bitcoind` (when in steady state) before this patch:

  ```
  $ src/bitcoind
  …
  0000-00-00T00:00:00Z UpdateTip: new best=0000000000000000000000000000000000000000000000000000000000000000 height=000000 version=0x00000000 log0_work=00.000000 tx=000000000 date='0000-00-00T00:00:00Z' progress=0.000000 cache=000.0MiB(0000000txo)
  0000-00-00T00:00:00Z UpdateTip: new best=0000000000000000000000000000000000000000000000000000000000000000 height=000000 version=0x00000000 log0_work=00.000000 tx=000000000 date='0000-00-00T00:00:00Z' progress=0.000000 cache=000.0MiB(0000000txo)
  0000-00-00T00:00:00Z Pre-allocating up to position 0x0000000 in blk00000.dat
  0000-00-00T00:00:00Z Pre-allocating up to position 0x000000 in rev00000.dat
  0000-00-00T00:00:00Z UpdateTip: new best=0000000000000000000000000000000000000000000000000000000000000000 height=000000 version=0x00000000 log0_work=00.000000 tx=000000000 date='0000-00-00T00:00:00Z' progress=0.000000 cache=000.0MiB(0000000txo)
  0000-00-00T00:00:00Z UpdateTip: new best=0000000000000000000000000000000000000000000000000000000000000000 height=000000 version=0x00000000 log0_work=00.000000 tx=000000000 date='0000-00-00T00:00:00Z' progress=0.000000 cache=000.0MiB(0000000txo)
  0000-00-00T00:00:00Z UpdateTip: new best=0000000000000000000000000000000000000000000000000000000000000000 height=000000 version=0x00000000 log0_work=00.000000 tx=000000000 date='0000-00-00T00:00:00Z' progress=0.000000 cache=000.0MiB(0000000txo)
  ```

  Expected standard output from `bitcoind` (when in steady state) after this patch:

  ```
  $ src/bitcoind
  …
  0000-00-00T00:00:00Z UpdateTip: new best=0000000000000000000000000000000000000000000000000000000000000000 height=000000 version=0x00000000 log0_work=00.000000 tx=000000000 date='0000-00-00T00:00:00Z' progress=0.000000 cache=000.0MiB(0000000txo)
  0000-00-00T00:00:00Z UpdateTip: new best=0000000000000000000000000000000000000000000000000000000000000000 height=000000 version=0x00000000 log0_work=00.000000 tx=000000000 date='0000-00-00T00:00:00Z' progress=0.000000 cache=000.0MiB(0000000txo)
  0000-00-00T00:00:00Z UpdateTip: new best=0000000000000000000000000000000000000000000000000000000000000000 height=000000 version=0x00000000 log0_work=00.000000 tx=000000000 date='0000-00-00T00:00:00Z' progress=0.000000 cache=000.0MiB(0000000txo)
  0000-00-00T00:00:00Z UpdateTip: new best=0000000000000000000000000000000000000000000000000000000000000000 height=000000 version=0x00000000 log0_work=00.000000 tx=000000000 date='0000-00-00T00:00:00Z' progress=0.000000 cache=000.0MiB(0000000txo)
  0000-00-00T00:00:00Z UpdateTip: new best=0000000000000000000000000000000000000000000000000000000000000000 height=000000 version=0x00000000 log0_work=00.000000 tx=000000000 date='0000-00-00T00:00:00Z' progress=0.000000 cache=000.0MiB(0000000txo)
  ```

  I find the latter alternative much easier to visually scan for anomalies (and more aesthetically pleasing TBH!).

  Non-GUI users deserve nice interfaces too :)

ACKs for top commit:
  laanwj:
    ACK 25f899cc23a791c08e19acae91bebda6c3538d37

Tree-SHA512: 5970798c41b041527ebdcbd843c5e136c257c28c3b21fc74102da8970406ca5c0c7e406305c5e6e67de5c1708dc1858af07a77a2e05f44159b7103423e8ab32f
2023-12-03 20:44:56 -06:00
MarcoFalke
ec4cbc28d6
Merge #20954: test: Declare nodes type in test_framework.py.
5353b0c64d32e44fc411464e080d4b00fae7124e Change type definitions for "chain" and "setup_clean_chain" from type comments to Python 3.6+ types. Additionally, set type for "nodes". (Kiminuo)

Pull request description:

  ### Motivation

  When I wanted to understand better https://github.com/bitcoin/bitcoin/pull/19145/files#diff-4bebbd3b112dc222ea7e75ef051838ceffcee63b9e9234a98a4cc7251d34451b test, I noticed that navigation in PyCharm/VS Code did not work for `nodes` variable. I think this is frustrating, especially for newcomers.

  ### Summary

  * This PR modifies Python 3.5 [type comments](https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html#variables) to Python 3.6+ types and adds a proper type for `nodes` [instance attribute](https://mypy.readthedocs.io/en/stable/class_basics.html#instance-and-class-attributes).
  * This PR does not change behavior.
  * This PR is intentionally very small, if the concept is accepted, a follow-up PRs can be more ambitious.

  ### End result

  1. Open `test/functional/feature_abortnode.py`
  2. Move your caret to: `self.nodes[0].generate[caret here](3)`
  3. Use "Go to definition" [F12] should work now.

  I have tested this on PyCharm (Windows, Ubuntu) and VS Code (Windows, Ubuntu).

  Note: Some `TestNode` methods (e.g. `self.nodes[0].getblock(...)` ) use `__call__` mechanism and navigation does not work for them even with this PR.

ACKs for top commit:
  laanwj:
    ACK 5353b0c64d32e44fc411464e080d4b00fae7124e
  theStack:
    ACK 5353b0c64d32e44fc411464e080d4b00fae7124e

Tree-SHA512: 821773f052ab9b2889dc357d38c59407a4af09e3b86d7134fcca7d78e5edf3a5ede9bfb37595ea97caf9ebfcbda372bcf73763b7f89b0677670f21b3e396a12b
2023-12-03 20:44:55 -06:00
MarcoFalke
a6cf5ebd88
Merge bitcoin-core/gui#183: Add include for std::bind.
2a39ccf1334ef3c48c6f9969a0fc916b9e10aae1 Add include for std::bind. (sinetek)

Pull request description:

  Hi, this patch adds in <functional> because the GUI code makes use of std::bind.
  That's all.

ACKs for top commit:
  jonasschnelli:
    utACK 2a39ccf1334ef3c48c6f9969a0fc916b9e10aae1

Tree-SHA512: fb5ac07d9cd5d006182b52857b289a9926362a2f1bfa4f7f1c78a088670e2ccf39ca28214781df82e8de3909fa3e69685fe1124a7e3ead758575839f5f2277a9
2023-12-03 20:44:55 -06:00
MarcoFalke
5db578c9d3
Merge bitcoin-core/gui#165: Save QSplitter state in QSettings
90f9fc274bf69b33adea593146ff5d6793123781 qt: Save QSplitter state in QSettings (Hennadii Stepanov)

Pull request description:

  This PR adds the ability to save the `QSplitter` widget state in `QSettings` during shutdown, and restore it on startup.

  A user no longer needs to adjust the splitter every time :)
  ![DeepinScreenshot_select-area_20201225211422](https://user-images.githubusercontent.com/32963518/103141024-046c3980-46f7-11eb-9a8c-83613527ffe1.png)

ACKs for top commit:
  jonasschnelli:
    utACK 90f9fc274bf69b33adea593146ff5d6793123781
  jonatack:
    ACK 90f9fc274bf69b33adea593146ff5d6793123781 this sets the "PeersTabSplitterSizes" value in the RPCConsole dtor and restores it in the RPCConsole ctor; tested in Debian with various split settings, tab open/close sequences, and shutdown methods, and the Peers window split state was faithfully maintained.

Tree-SHA512: efbd6a4cee512982944955d36775e75a8a217b1dc49e62d42c6e402d2710dd44324b2c3c1edeb5fe38d9229e0e4a39734d1f4e63405ade8694762e1bbf72020b
2023-12-03 20:44:55 -06:00
MarcoFalke
2d41bfbab9
Merge #20765: fuzz: check that certain script TxoutType are nonstandard
efaf80e9bb0afeca2955720bfe6c225d7864036b fuzz: check that certain script TxoutType are nonstandard (Michael Dietz)

Pull request description:

  - Every transaction of type NONSTANDARD must not be a standard script
  - The only know types of nonstandard scripts are NONSTANDARD and certain NULL_DATA and MULTISIG scripts

  When reviewing https://github.com/bitcoin/bitcoin/pull/20761 I figured this is very similar and might also be good to have

ACKs for top commit:
  MarcoFalke:
    ACK efaf80e9bb0afeca2955720bfe6c225d7864036b

Tree-SHA512: 6f563ee3104ea9d2633aad95f1d003474bea759d0f22636c37aa91b5536a6ff0800c42447285ca8ed12f1b3699bf781dae1e5e0a3362da578749cd3164a06ea4
2023-12-03 20:44:54 -06:00
Wladimir J. van der Laan
ecabacd492
Merge #20248: test: fix length of R check in key_signature_tests
89895773b72275a620951730aef0b52e9437bc13 Fix length of R check in test/key_tests.cpp:key_signature_tests (Dmitry Petukhov)

Pull request description:

  The code before the fix only checked the length of R value of the last
  signature in the loop, and only for equality (but the length can be
  less than 32)

  The fixed code checks that length of the R value is less than or equal
  to 32 on each iteration of the loop

ACKs for top commit:
  laanwj:
    ACK 89895773b72275a620951730aef0b52e9437bc13

Tree-SHA512: 73eb2bb4a6c1c5fc11dd16851b28b43037ac06ef8cfc3b1f957429a1fca295c9422d67ec6c73c0e4bb4919f92e22dc5d733e84840b0d01ad1a529aa20d906ebf
2023-12-03 20:44:54 -06:00
fanquake
21676ff35d
Merge #18896: qt: Reset toolbar after all wallets are closed
1e9bfd4926a3cbb9db877c773a60b0bbbbe8bde0 qt: Reset toolbar after all wallets are closed (Hennadii Stepanov)

Pull request description:

  If the last open wallet is closed from the non-"Overview" tab, that tab remains active when a new wallet is opened:

  ![Screenshot from 2020-05-06 09-00-26](https://user-images.githubusercontent.com/32963518/81142394-46821880-8f78-11ea-84b5-1d02f2b7f3f1.png)

  This PR fixes this bug.

ACKs for top commit:
  promag:
    Code review ACK 1e9bfd4926a3cbb9db877c773a60b0bbbbe8bde0.
  luke-jr:
    utACK 1e9bfd4926a3cbb9db877c773a60b0bbbbe8bde0
  jonasschnelli:
    utACK 1e9bfd4926a3cbb9db877c773a60b0bbbbe8bde0

Tree-SHA512: a8dfd7591267e9544ad40c87581d554e5cfaad4b2a5bbfdbaf2596dc6869d2ac6cf7877adfef3d528fc61b081d40c6e30d787bbd7280ef7946aa7f7d9bc8b18e
2023-12-03 20:44:52 -06:00
PastaPastaPasta
7b6c1beeba
Merge pull request #5681 from vijaydasmp/bp22_17
backport: Merge bitcoin#20466,14604,15710,17458,18722,(partial) 17934
2023-12-03 20:33:26 -06:00
fanquake
0181d2bb15 (partial) Merge #17934: doc: Use CONFIG_SITE variable instead of --prefix option
223b1ba7d90509a47ea07af46f4b9c3b8efbc9f8 doc: Use CONFIG_SITE instead of --prefix (Hennadii Stepanov)

Pull request description:

  The current examples of `--prefix=...` option usage to point `configure` script to appropriate `depends` directory is not [standard](https://www.gnu.org/prep/standards/html_node/Directory-Variables.html). This causes some [confusion](https://github.com/bitcoin/bitcoin/pull/16691) and a bit of inconvenience.

  Consider a CentOS 7 32 bit system. Packages `libdb4-devel`, `libdb4-cxx-devel`, `miniupnpc-devel` and `zeromq-devel` are unavailable from repos. After recommended build with depends:
  ```
  cd depends
  make
  cd ..
  ./autogen.sh
  ./configure --prefix=$PWD/depends/i686-pc-linux-gnu
  make
  ```
  a user is unable to `make install` compiled binaries neither locally (to `~/.local`) nor system-wide (to `/usr/local`) as `--prefix` is set already.

  Meanwhile, the standard approach with using [`config.site`](https://www.gnu.org/software/automake/manual/html_node/config_002esite.html) files allows both possibilities:

  ```
  cd depends
  make
  cd ..
  ./autogen.sh
  CONFIG_SITE=$PWD/depends/i686-pc-linux-gnu/share/config.site ./configure --prefix ~/.local
  make
  make install
  ```

  or

  ```
  CONFIG_SITE=$PWD/depends/i686-pc-linux-gnu/share/config.site ./configure
  make
  sudo make install  # install to /usr/local
  ```

  Moreover, this approach is used in [Gitian descriptors](https://github.com/bitcoin/bitcoin/tree/master/contrib/gitian-descriptors) already.

ACKs for top commit:
  practicalswift:
    ACK 223b1ba7d90509a47ea07af46f4b9c3b8efbc9f8: patch looks correct
  fanquake:
    ACK 223b1ba7d90509a47ea07af46f4b9c3b8efbc9f8

Tree-SHA512: 46d97924f0fc7e95ee4566737cf7c2ae805ca500e5c49af9aa99ecc3acede4b00329bc727a110aa1b62618dfbf5d1ca2234e736f16fbdf96d6ece5f821712f54
2023-12-03 20:32:22 -06:00
fanquake
51c69d1d0a Merge bitcoin/bitcoin#18722: addrman: improve performance by using more suitable containers
a92485b2c250fd18f55d22aa32722bf52ab32bfe addrman: use unordered_map instead of map (Vasil Dimov)

Pull request description:

  `CAddrMan` uses `std::map` internally even though it does not require
  that the map's elements are sorted. `std::map`'s access time is
  `O(log(map size))`. `std::unordered_map` is more suitable as it has a
  `O(1)` access time.

  This patch lowers the execution times of `CAddrMan`'s methods as follows
  (as per `src/bench/addrman.cpp`):

  ```
  AddrMan::Add(): -3.5%
  AddrMan::GetAddr(): -76%
  AddrMan::Good(): -0.38%
  AddrMan::Select(): -45%
  ```

ACKs for top commit:
  jonatack:
    ACK a92485b2c250fd18f55d22aa32722bf52ab32bfe
  achow101:
    ACK a92485b2c250fd18f55d22aa32722bf52ab32bfe
  hebasto:
    re-ACK a92485b2c250fd18f55d22aa32722bf52ab32bfe, only suggested changes and rebased since my [previous](https://github.com/bitcoin/bitcoin/pull/18722#pullrequestreview-666663681) review.

Tree-SHA512: d82959a00e6bd68a6c4c5a265dd08849e6602ac3231293b7a3a3b7bf82ab1d3ba77f8ca682919c15c5d601b13e468b8836fcf19595248116635f7a50d02ed603
2023-12-03 20:32:22 -06:00
Samuel Dobson
51ff73a3d1 Merge #17458: Refactor OutputGroup effective value calculations and filtering to occur within the struct
9adc2f80fc14f11ee2b1f989ee7be71b58481e6f Refactor OutputGroups to handle effective values, fees, and filtering (Andrew Chow)
7d07e864b8846be186648814a5aaf34269f914a3 Use real value when calculating OutputGroup value (Andrew Chow)

Pull request description:

  Currently, the effective values and filtering for positive effective values is done outside of the OutputGroup. We should instead have functions in Outputgroup to do this and call those for each OutputGroup. So this PR does that.

  This makes future changes for effective values in coin selection much easier.

ACKs for top commit:
  instagibbs:
    reACK 9adc2f80fc14f11ee2b1f989ee7be71b58481e6f
  fjahr:
    re-ACK 9adc2f80fc14f11ee2b1f989ee7be71b58481e6f
  meshcollider:
    Light code review ACK 9adc2f80fc14f11ee2b1f989ee7be71b58481e6f

Tree-SHA512: 7445c94b7295b45bcd83a6f8a5c8f6961a89453fcc856335192d4b4a66aec7724513616b04e5111588ab208c89b311055399d6279cd9c4ce452aefb85f04b64a
2023-12-03 20:32:22 -06:00
Wladimir J. van der Laan
6853849642 Merge #15710: wallet: Catch ios_base::failure specifically
7486e2771e7b5d6fa84df6e954be76350c84e220 Tests: Unit test related to WalletDB ReadKeyValue (Bushstar)
32def8d1c29e0855fe5429687acabd2f29119316 Catch ios_base::failure specifically (Peter Bushnell)

Pull request description:

  In https://github.com/bitcoin/bitcoin/pull/2950 a hash of the pubkey and private was added to speed up key import, this was made backwards compatible by reading the hash in a try block with an ellipses catch all in case the hash was not present.

  CDataStream::read() specifically throws std::ios_base::failure, backwards compatibility expects only that error to be thrown, if something else gets thrown we should not be catching it. The change in this commit is to catch that exception only. If any other exception is thrown other than std::ios_base::failure it will be caught by the wider try block and an error written to the log and/or console.

  CDataStream::read() throwing std::ios_base::failure.
  2c364fde42/src/streams.h (L191)

  Wider catch statements that pick up all others exceptions other than ios_base::failure.
  2c364fde42/src/wallet/walletdb.cpp (L425)

  2c364fde42/src/wallet/walletdb.cpp (L430)

ACKs for top commit:
  laanwj:
    Code review ACK 7486e2771e7b5d6fa84df6e954be76350c84e220

Tree-SHA512: 5364bf935af8ec603bf5b8fef8c23b5cdaa4fe3506090cff988413221f2eaa99f7a91929afb42a35f8881ce2328744a0d32052da51ca0a5b2e65b6809e97f604
2023-12-03 20:32:22 -06:00
MarcoFalke
7fbc0f359c Merge bitcoin/bitcoin#14604: tests: Add test and refactor feature_block.py
55311197c483477b79883da5da09f2bc71acc7cf Added new test for future blocks reacceptance (sanket1729)
511a5af4622915c236cfb11df5234232c2983e45 Fixed inconsistencies between code and comments (sanket1729)

Pull request description:

  This Commit does 3 things:
  1) Adds a test case for checking reacceptance a previously rejected block which
  was too far in the future.
  ~~2) clean up uses of rehash or calc_sha256 where it was not needed~~
  3) While constructing block 44, this commit makes the code consistent with the expected figure in
  the comment just above it by adding a transaction to the block.
  4) Fix comment describing `sign_tx()` function

ACKs for top commit:
  duncandean:
    reACK 5531119
  brunoerg:
    reACK 55311197c483477b79883da5da09f2bc71acc7cf

Tree-SHA512: d40c72fcdbb0b2a0715adc58441eeea08147ee2ec5e371a4ccc824ebfdc6450698bd40aaeecb7ea7bfdb3cd1b264dd821b890276fff8b8d89b7225cdd9d6b546
2023-12-03 20:32:22 -06:00
MarcoFalke
d667e57dc6 Merge #20466: test: Fix intermittent p2p_fingerprint issue
fad7be584ffaf8099cc099d9378ba831c9483260 test: Fix intermittent p2p_finerprint issue (MarcoFalke)

Pull request description:

  A single sync_with_ping can't be used to drop a block announcement, as the block might be sent *after* the ping has been responded to.

  Fix that by waiting for the block.

ACKs for top commit:
  theStack:
    ACK fad7be584ffaf8099cc099d9378ba831c9483260

Tree-SHA512: d43ba9d07273486858f65a26326cc6637ef743bf7b400e5048ba7eac266fb1893283e6503dd49f179caa1abab2977315fb70ba9fba34be9a817a74259d8e4034
2023-12-03 20:32:22 -06:00
PastaPastaPasta
5783743f9f
Merge pull request #5677 from vijaydasmp/bp23_3
backport: Merge bitcoin#22530,(partial)21562,22322,22517
2023-12-03 20:26:23 -06:00
MarcoFalke
12312784a2 Merge bitcoin/bitcoin#22517: fuzz: Temporarily disable failing assert in banman fuzz test
fa8bed6a47c88f769ae05b04b93eeaf2e1011478 fuzz: Temporarily disable failing assert in banman fuzz test (MarcoFalke)

Pull request description:

  Otherwise the remainder of the fuzz test can't be fuzzed without running into crashes

ACKs for top commit:
  practicalswift:
    cr ACK fa8bed6a47c88f769ae05b04b93eeaf2e1011478

Tree-SHA512: ec6606292e2cfd26484c7f6caf1c418c377da54111b332990fce68373f0438defda71d931a42ca34431527fbc172dd2fdf29b260afca15b34910ee137de1c365
2023-12-03 20:25:16 -06:00
MarcoFalke
6ba92a6117 Merge bitcoin/bitcoin#22322: fuzz: Check banman roundtrip
fa485d06ec10acd9a791f8d29689e1e82591fb70 fuzz: Check banman roundtrip (MarcoFalke)

Pull request description:

ACKs for top commit:
  practicalswift:
    cr ACK fa485d06ec10acd9a791f8d29689e1e82591fb70
  vasild:
    ACK fa485d06ec10acd9a791f8d29689e1e82591fb70

Tree-SHA512: 84e297c0b90ef68d72afd2053bfda2888496c1b180233516a8caaf76d6c03403f1e4ed59f1eb32d799873fc34009634b4ce372244b9d546d04626af41ac4d1d7
2023-12-03 20:25:16 -06:00
MarcoFalke
f4ea109e65 (partial) Merge bitcoin/bitcoin#21562: [net processing] Various tidying up of PeerManagerImpl ctor
fde1bf4f6136638e84cdf9806eedaae08e841bbf [net processing] Default initialize m_recent_confirmed_transactions (John Newbery)
37dcd12d539e4a875581fa049aa0f7fafeb932a4 scripted-diff: Rename recentRejects (John Newbery)
cd9902ac5054c01228d52616bf85f7196364d4ff [net processing] Default initialize recentRejects (John Newbery)
a28bfd1d4cfa523a6abf3832dbfd6183cd546944 [net processing] Default initialize m_stale_tip_check_time (John Newbery)
9190b01d8dcf03b74e9b9e1653688a97ac171b37 [net processing] Add Orphanage empty consistency check (John Newbery)

Pull request description:

  - Use default initialization of PeerManagerImpl members where possible
  - Remove unique_ptr indirection where it's not needed

ACKs for top commit:
  MarcoFalke:
    ACK fde1bf4f6136638e84cdf9806eedaae08e841bbf 👞
  theStack:
    re-ACK fde1bf4f6136638e84cdf9806eedaae08e841bbf

Tree-SHA512: 7ddedcc972df8e933e1fbe5c88b8ea17df89e1e58fc769518512c5540e49dc8eddb3f47e78d1329a6fc5644d2c1d11c981f681fd633f5218bfa4b3e6a86f3d7b
2023-12-03 20:25:16 -06:00
MarcoFalke
42aea04810 Merge bitcoin/bitcoin#22530: log: sort logging categories alphabetically
d596dba9877e7ead3fb5426cbe7e608fbcbfe3eb test: assert logging categories are sorted in rpc and help (Jon Atack)
17bbff3b88132c0c95b29b59100456b85e26df75 log, refactor: use guard clause in LogCategoriesList() (Jon Atack)
7c57297319bc386afaf06528778384fe58576ef9 log: sort LogCategoriesList and LogCategoriesString alphabetically (Jon Atack)
f720cfa824f1be863349e7016080f8fb1c3c76c2 test: verify number of categories returned by logging RPC (Jon Atack)

Pull request description:

  Sorting the logging categories seems more user-friendly with the number of categories we now have, allowing CLI users to more quickly find a particular category.

  before
  ```
  $ bitcoin-cli help logging
  ...
  The valid logging categories are: net, tor, mempool, http, bench, zmq, walletdb, rpc, estimatefee, addrman, selectcoins, reindex, cmpctblock, rand, prune, proxy, mempoolrej, libevent, coindb, qt, leveldb, validation, i2p, ipc

  $ bitcoind -h | grep -A8 "debug=<category>"
    -debug=<category>
         ...
         output all debugging information. <category> can be: net, tor,
         mempool, http, bench, zmq, walletdb, rpc, estimatefee, addrman,
         selectcoins, reindex, cmpctblock, rand, prune, proxy, mempoolrej,
         libevent, coindb, qt, leveldb, validation, i2p, ipc.

  $ bitcoin-cli logging [] '["addrman"]'
  {
    "net": false,
    "tor": true,
    "mempool": false,
    "http": false,
    "bench": false,
    "zmq": false,
    "walletdb": false,
    "rpc": false,
    "estimatefee": false,
    "addrman": false,
    "selectcoins": false,
    "reindex": false,
    "cmpctblock": false,
    "rand": false,
    "prune": false,
    "proxy": true,
    "mempoolrej": false,
    "libevent": false,
    "coindb": false,
    "qt": false,
    "leveldb": false,
    "validation": false,
    "i2p": true,
    "ipc": false
  }
  ```

  after

  ```
  $ bitcoin-cli help logging
  ...
  The valid logging categories are: addrman, bench, cmpctblock, coindb, estimatefee, http, i2p, ipc, leveldb, libevent, mempool, mempoolrej, net, proxy, prune, qt, rand, reindex, rpc, selectcoins, tor, validation, walletdb, zmq

  $ bitcoind -h | grep -A8 "debug=<category>"
    -debug=<category>
         ...
         output all debugging information. <category> can be: addrman,
         bench, cmpctblock, coindb, estimatefee, http, i2p, ipc, leveldb,
         libevent, mempool, mempoolrej, net, proxy, prune, qt, rand,
         reindex, rpc, selectcoins, tor, validation, walletdb, zmq.

  $ bitcoin-cli logging [] '["addrman"]'
  {
    "addrman": false,
    "bench": false,
    "cmpctblock": false,
    "coindb": false,
    "estimatefee": false,
    "http": false,
    "i2p": false,
    "ipc": false,
    "leveldb": false,
    "libevent": false,
    "mempool": false,
    "mempoolrej": false,
    "net": false,
    "proxy": false,
    "prune": false,
    "qt": false,
    "rand": false,
    "reindex": false,
    "rpc": false,
    "selectcoins": false,
    "tor": false,
    "validation": false,
    "walletdb": false,
    "zmq": false
  }
  ```

ACKs for top commit:
  theStack:
    re-ACK d596dba9877e7ead3fb5426cbe7e608fbcbfe3eb

Tree-SHA512: d546257f562b0a288d1b19a028f1a510aaf21bd21da058e7c84653d305ea8662ecb4647ebefd2b97411f845fe5b0b841d40d3fe6814eefcb8ce82df341dfce22
2023-12-03 20:25:16 -06:00
PastaPastaPasta
cefa2eb735
Merge pull request #5663 from vijaydasmp/bp23_2
backport: Merge bitcoin#(partial) 21940,(partial) 22232,22505,22407,22510,22383,13533,22528,22538,22139
2023-12-03 20:15:17 -06:00
MarcoFalke
0845e1956e Merge bitcoin/bitcoin#22139: test: add type annotations to util.get_rpc_proxy
fbeb8c43bc5bce131e15eb9e162ea457bfe2b83e test: add type annotations to util.get_rpc_proxy (fanquake)

Pull request description:

  Split out from #22092 while we address the functional test failure.

ACKs for top commit:
  instagibbs:
    ACK fbeb8c43bc

Tree-SHA512: 031ef8703202ae5271787719fc3fea8693574b2eb937ccf852875de95798d7fa3c39a8db7c91993d0c946b45d9b4d6de570bd1102e0344348784723bd84803a8
2023-12-03 20:13:09 -06:00
fanquake
693abb2083 Merge bitcoin/bitcoin#22538: doc: fix command typo in guix README
198ceb82f91bfdeac6e143ca7433f4a524f6f36f script, doc: guix touchups (jonatack)
d7b7f610a53aa62bd82f6704a9c518a93c896963 Updated Readme, Corrected the codesign typo (h)

Pull request description:

ACKs for top commit:
  jamesob:
    ACK 198ceb82f9
  jonatack:
    ACK 198ceb82f91bfdeac6e143ca7433f4a524f6f36f

Tree-SHA512: 408360cebb51cff330fdd5d5d8ae91a168cdc99fb1377913fd9119e6eba536e58f87ff5c5b479e21a21fa3403323b137c338005bbd67e6fd24314929cdff9325
2023-12-03 20:13:09 -06:00
MarcoFalke
fbddd23cd4 Merge bitcoin/bitcoin#22528: refactor: move GetTransaction to node/transaction.cpp
f685a13bef0418663015ea6d8f448f075510c0ec doc: GetTransaction()/getrawtransaction follow-ups to #22383 (John Newbery)
abc57e1f0882a1a2bb20474648419979af6e383d refactor: move `GetTransaction(...)` to node/transaction.cpp (Sebastian Falbesoner)

Pull request description:

  ~This PR is based on #22383, which should be reviewed first~ (merged by now).

  In [yesterday's PR review club session to PR 22383](https://bitcoincore.reviews/22383), the idea of moving the function `GetTransaction(...)` from src/validation.cpp to src/node/transaction.cpp came up. With this, the circular dependency "index/txindex -> validation -> index/txindex" is removed (see change in `lint-circular-dependencies.sh`). Thanks to jnewbery for suggesting and to sipa for providing historical background.

  Relevant IRC log:
  ```
  17:52 <jnewbery> Was anyone surprised that GetTransaction() is in validation.cpp? It seems to me that node/transaction.cpp would be a more appropriate place for it.
  17:53 <raj_> jnewbery, +1
  17:53 <stickies-v> agreed!
  17:54 <glozow> jnewbery ya
  17:54 <jnewbery> seems weird that validation would call into txindex. I wonder if we remove this function, then validation would no longer need to #include txindex
  17:54 <sipa> GetTransaction predates node/transaction.cpp, and even the generic index framework itself :)
  17:55 <sipa> (before 0.8, validation itself used the txindex)
  17:55 <jnewbery> (and GetTransaction() seems like a natural sibling to BroadcastTransaction(), which is already in node/transaction.cpp)
  17:55 <jnewbery> sipa: right, this is not meant as a criticism of course. Just wondering if we can organize things a bit more rationally now that we have better separation between things.
  17:55 <sipa> jnewbery: sure, just providing background
  17:56 <sipa> seems very reasonable to move it elsewhere now
  ```

  The commit should be trivial to review with `--color-moved`.

ACKs for top commit:
  jnewbery:
    Code review ACK f685a13bef0418663015ea6d8f448f075510c0ec
  rajarshimaitra:
    tACK f685a13bef
  mjdietzx:
    crACK f685a13bef0418663015ea6d8f448f075510c0ec
  LarryRuane:
    Code review, test ACK f685a13bef0418663015ea6d8f448f075510c0ec

Tree-SHA512: 0e844a6ecb1be04c638b55bc4478c2949549a4fcae01c984eee078de74d176fb19d508fc09360a62ad130677bfa7daf703b67870800e55942838d7313246248c
2023-12-03 20:13:09 -06:00
MarcoFalke
8109f0046d Merge bitcoin/bitcoin#13533: [tests] Reduced number of validations in tx_validationcache_tests
c3e111a7daf5800026dda4455c737de0412528f1 Reduced number of validations in `tx_validationcache_tests` to keep the run time reasonable. (lucash-dev)

Pull request description:

  Following a suggestion in the comments, changed `ValidateCheckInputsForAllFlags` from testing all possible flag combinations to testing a random subset. Also created a new enum constant for the highest flag, so that this test doesn’t keep testing an incomplete subset in case a new flag is added.

  Timing for `checkinputs_test`:
  ```
  Before:   6.8s
  After:    3.7s
  ----------------
  Saved:    3.1s (45%)
  ```

  This PR was split from #13050. Also see #10026.

ACKs for top commit:
  leonardojobim:
    tACK c3e111a7da.
  kallewoof:
    ACK c3e111a7daf5800026dda4455c737de0412528f1
  theStack:
    re-ACK c3e111a7daf5800026dda4455c737de0412528f1

Tree-SHA512: bef49645bdd4f61ec73cc77a9f028b95d9856db9446d2e7fc9a48867a6f0e94c2c9f150cb771a30fe852db0efb0a1bd15d38b00d712651793ccb59ff6157a7b4
2023-12-03 20:13:09 -06:00
MarcoFalke
ad3086c629 Merge bitcoin/bitcoin#22383: rpc: Prefer to use txindex if available for GetTransaction
78f4c8b98eada337346ffb206339c3ebae4ff43b prefer to use txindex if available for GetTransaction (Jameson Lopp)

Pull request description:

  Fixes #22382

  Motivation: prevent excessive disk reads if txindex is enabled.

  Worth noting that this could be argued to be less of a bug and more of an issue of undefined behavior. If a user calls GetTransaction with the wrong block hash, what should happen?

ACKs for top commit:
  jonatack:
    ACK 78f4c8b98eada337346ffb206339c3ebae4ff43b
  theStack:
    Code review ACK 78f4c8b98eada337346ffb206339c3ebae4ff43b
  LarryRuane:
    tACK 78f4c8b98eada337346ffb206339c3ebae4ff43b
  luke-jr:
    utACK 78f4c8b98eada337346ffb206339c3ebae4ff43b
  jnewbery:
    utACK 78f4c8b98eada337346ffb206339c3ebae4ff43b
  rajarshimaitra:
    Code review ACK 78f4c8b98e
  lsilva01:
    Code Review ACK and Tested ACK 78f4c8b98e on Ubuntu 20.04

Tree-SHA512: af7db5b98cb2ae4897b28476b2fa243bf7e6f850750d9347062fe8013c5720986d1a3c808f80098e5289bd84b085de03c81a44e584dc28982f721c223651bfe0
2023-12-03 20:13:09 -06:00
MarcoFalke
7eb5033d28 Merge bitcoin/bitcoin#22510: test: add test for RPC error 'Transaction already in block chain'
2ebf2fe0e4727a5a57a03f4283bdf1e263855803 test: check for RPC error 'Transaction already in block chain' (-27) (Sebastian Falbesoner)

Pull request description:

  This PR adds missing test coverage for the RPC error "Transaction already in block chain" (error code `RPC_VERIFY_ALREADY_IN_CHAIN` = `RPC_TRANSACTION_ALREADY_IN_CHAIN` = -27), which is thrown in the function `BroadcastTransaction` (src/node/transaction.cpp).

ACKs for top commit:
  kristapsk:
    ACK 2ebf2fe0e4727a5a57a03f4283bdf1e263855803 (ran linter, looked at changes and ran modified test and checked code in `src/node/transaction.cpp`)
  darosior:
    ACK 2ebf2fe0e4727a5a57a03f4283bdf1e263855803

Tree-SHA512: 8bfbd3ff3da0cb3b8745f69b8ca2377f85fa99f0270750840b60e6ae43b5645c5c59b236993e8b2ad0444ec4171484e4f1ee23fa7e81b79d4222bcb623666fa5
2023-12-03 20:13:09 -06:00
MarcoFalke
06e467154f Merge bitcoin/bitcoin#22407: rpc: Return block time in getblockchaininfo
20edf4bcf61e9fa310c3d7f3cac0c80a04df5364 rpc: Return block time in getblockchaininfo (João Barbosa)

Pull request description:

  Return tip time in `getblockchaininfo`, for some use cases this can save a call to `getblock`.

ACKs for top commit:
  naumenkogs:
    ACK 20edf4bcf61e9fa310c3d7f3cac0c80a04df5364
  theStack:
    re-ACK 20edf4bcf61e9fa310c3d7f3cac0c80a04df5364
  0xB10C:
    ACK 20edf4bcf61e9fa310c3d7f3cac0c80a04df5364
  kristapsk:
    ACK 20edf4bcf61e9fa310c3d7f3cac0c80a04df5364
  Zero-1729:
    re-ACK 20edf4bcf61e9fa310c3d7f3cac0c80a04df5364

Tree-SHA512: 29a920cfff1ef53e0af601c3f93f8f9171f3be47fc84b0fa293cb865b824976e8c1510b17b27d17daf0b8e658dd77d9dc388373395f0919fc4a23cd5019642d5
2023-12-03 20:13:09 -06:00
fanquake
795fe6a864 Merge bitcoin/bitcoin#22505: addrman: Remove unused test_before_evict argument from Good()
f036dfbb692c4d44d0f59194d089ed0aa1096347 [addrman] Remove unused test_before_evict argument from Good() (John Newbery)

Pull request description:

  This has never been used in the public interface method since it was
  introduced in #9037.

ACKs for top commit:
  lsilva01:
    Tested ACK f036dfbb69 on Ubuntu 20.04.
  theStack:
    Code-review ACK f036dfbb692c4d44d0f59194d089ed0aa1096347

Tree-SHA512: 98145d9596b4ae1f354cfa561be1a54c6b8057c920e0ac3d4c1d42c9326b2dad2d44320f4171bb701d97088b216760cca8017b84c8b5dcd2b1dc8f158f28066d
2023-12-03 20:13:09 -06:00
MarcoFalke
c338cd69d4 (partial) Merge bitcoin/bitcoin#22232: refactor: Pass interpreter flags as uint32_t instead of signed int
fa621ededdfe31a200b77a8787de7e3d2e667aec refactor: Pass script verify flags as uint32_t (MarcoFalke)

Pull request description:

  The flags are cast to unsigned in the interpreter anyway, so avoid the confusion (and fuzz crashes) by just passing them as unsigned from the beginning.

  Also, the flags are often inverted bit-wise with the `~` operator, which also works on signed integers, but might cause confusion as the sign bit is flipped.

  Fixes #22233

ACKs for top commit:
  theStack:
    Concept and code review ACK fa621ededdfe31a200b77a8787de7e3d2e667aec
  kristapsk:
    ACK fa621ededdfe31a200b77a8787de7e3d2e667aec
  jonatack:
    ACK fa621ededdfe31a200b77a8787de7e3d2e667aec

Tree-SHA512: ea0720f32f823fa7f075309978672aa39773c6019d12b6c1c9d611fc1983a76115b7fe2a28d50814673bb6415c311ccc05b99d6e871575fb6900faf75ed17769
2023-12-03 20:13:09 -06:00
MarcoFalke
f40cb714e5 (partial) Merge bitcoin/bitcoin#21940: refactor: Mark CAddrMan::Select and GetAddr const
fae108ceb53f61d7338ba205873623ede3c1d3be Fix incorrect whitespace in addrman (MarcoFalke)
fa32024d51c098441623e246f304a80f011e29d1 Add missing GUARDED_BY to CAddrMan::insecure_rand (MarcoFalke)
fab755b77f88873f01cbd988051de7ad3f0150de fuzz: Actually use const addrman (MarcoFalke)
fae0c79351ce34186249d44af0c5c9c7521f4b6c refactor: Mark CAddrMan::GetAddr const (MarcoFalke)
fa02934c8c9d290ea4d12683e8680c70967a4d3a refactor: Mark CAddrMan::Select const (MarcoFalke)

Pull request description:

  To clarify that a call to this only changes the random state and nothing else.

ACKs for top commit:
  jnewbery:
    Code review ACK fae108ceb53f61d7338ba205873623ede3c1d3be
  theStack:
    re-ACK fae108ceb53f61d7338ba205873623ede3c1d3be 🍦

Tree-SHA512: 3ffb211d4715cc3daeb3bfcdb3fcc6b108ca96df5fa565510436fac0e8da86c93b30c9c4aad0563e27d84f615fcd729481072009a4e2360c8b3d40787ab6506a
2023-12-03 20:13:09 -06:00
PastaPastaPasta
63b907126f
Merge pull request #5541 from knst/bp-v21-p2
backport: bitcoin#18413, #18610, #18759, #18855, #18861, #18931, #18962, #19304, #26896, partial #18628
2023-12-03 20:02:57 -06:00
MarcoFalke
f947086292 Merge #18855: tests: feature_backwards_compatibility.py test downgrade after upgrade
489ebfd7a16443d8263c048d55622da297df7c39 tests: feature_backwards_compatibility.py test downgrade after upgrade (Andrew Chow)

Pull request description:

  After upgrading the node, try to go back to the original version to make sure that using a newer node version does not prevent the wallet file from being downgraded again.

ACKs for top commit:
  MarcoFalke:
    ACK 489ebfd7a16443d8263c048d55622da297df7c39

Tree-SHA512: 86231de6514b3657912fd9d6621212166fd2b29b591fc97120092c548babcf1d6f50b5bd103b28cecde395a26809134f01c1a198725596c3626420de3fd1f017
2023-12-03 20:01:26 -06:00
fanquake
81f64f7116 Merge #18413: script: prevent UB when computing abs value for num opcode serialize
2748e8793267126c5b40621d75d1930e358f057e script: prevent UB when computing abs value for num opcode serialize (pierrenn)

Pull request description:

  This was reported by practicalswift here #18046

  It seems that the original author of the line used a reference to glibc `abs`: https://github.com/lattera/glibc/blob/master/stdlib/abs.c

  However depending on some implementation details this can be undefined behavior for unusual values.

  A detailed explanation of the UB is provided here : https://stackoverflow.com/questions/17313579/is-there-a-safe-way-to-get-the-unsigned-absolute-value-of-a-signed-integer-with (by [Billy O'Neal](https://twitter.com/malwareminigun))

  Simple relevant godbolt example :  https://godbolt.org/z/yRwtCG

  Thanks!

ACKs for top commit:
  sipa:
    ACK 2748e8793267126c5b40621d75d1930e358f057e
  MarcoFalke:
    ACK 2748e8793267126c5b40621d75d1930e358f057e, only checked that the bitcoind binary does not change with clang -O2 🎓
  practicalswift:
    ACK 2748e8793267126c5b40621d75d1930e358f057e

Tree-SHA512: 539a34c636c2674c66cb6e707d9d0dfdce63f59b5525610ed88da10c9a8d59d81466b111ad63b850660cef3750d732fc7755530c81a2d61f396be0707cd86dec
2023-12-03 20:01:26 -06:00
MarcoFalke
fa9e34c2e1 Merge #18759: bench: Start nodes with -nodebuglogfile
fabe44e8154a6068d6cba91ec30f00345ed7b275 bench: Start nodes with -nodebuglogfile (MarcoFalke)

Pull request description:

  For benchmarking we don't want to depend on the speed of the disk or the amount of debug logging

ACKs for top commit:
  fanquake:
    ACK fabe44e8154a6068d6cba91ec30f00345ed7b275 - This makes some of these benchmarks significantly faster to run. MempoolEviction total runtime is down from ~46s to 11s on my machine:

Tree-SHA512: d99700901650325896b9115d20b84a27042152f46266f595bf7ea1414528c0b346f4e707a12ee8b8ba99c35cf155e645e67971c1b2a679c4e609c400ff8b08ae
2023-12-03 20:01:26 -06:00
fanquake
26211cc22f Merge bitcoin/bitcoin#26896: build: Remove port-forwarding runtime setting options from configure
d51f0fa4b7b19281efe65aacf414845c661d0a13 doc: add release notes for 26896 (fanquake)
2b248798d96f794db08b7725730b5fb4e00b9b10 build: remove --enable-upnp-default from configure (fanquake)
02f5a5e7b5fd7ba35e407d4409202a0e0fed003c build: remove --enable-natpmp-default from configure (fanquake)
25a0e8ba0b31d8bd265df0589fe49241a60d0fc2 Remove configure-time setting of DEFAULT_UPNP (fanquake)
06562e5fa771dab275a9cab4914cd64d961a52bc Remove configure-time setting of DEFAULT_NATPMP (fanquake)

Pull request description:

  This PR removes the `--enable-upnp-default` and `--enable-natpmp-default` options from configure.

  It's odd to me that we maintain configure-time options for setting the default port-forwarding runtime state (but no other similar options), and I'm not sure what use-case it satisfies, that can't be achieved by multiple other means. I also doubt that we'll ever restart using these in release builds, or turning on any of this by default.

  I think the only scenario these options would be used is when you want to compile your own binaries (we don't use them in Guix), with port-forwarding on by default, but otherwise can't or don't want to use a `.conf` file, can't or don't want to pass command line options at runtime, and also don't want to modify the source code?

ACKs for top commit:
  hebasto:
    ACK d51f0fa4b7b19281efe65aacf414845c661d0a13, rebased and comments have been addressed since my recent [review](https://github.com/bitcoin/bitcoin/pull/26896#pullrequestreview-1273910740).
  TheCharlatan:
    ACK d51f0fa4b7b19281efe65aacf414845c661d0a13

Tree-SHA512: 481decd8bddd8b03b7319591e3acf189f7b6b96c9a9a8c5bc1a3f8ec00d0b8f9b52d2f5c28a298a2ec947cfe9611cfd184e393ccb2e4e21bfce86ca7d4de60d3
2023-12-03 20:01:26 -06:00
fanquake
25eb5cbb4b Merge #18861: Do not answer GETDATA for to-be-announced tx
2896c412fadbc03916a33028f4f50fd87ac48edb Do not answer GETDATA for to-be-announced tx (Pieter Wuille)
f2f32a3dee9a965c8198f9ddd3aaebc627c273e4 Push down use of cs_main into FindTxForGetData (Pieter Wuille)
c6131bf407c1ada78a0e5509a702bc7da0bfd57d Abstract logic to determine whether to answer tx GETDATA (Pieter Wuille)

Pull request description:

  This PR intends to improve transaction-origin privacy.

  In general, we should try to not leak information about what transactions we have (recently) learned about before deciding to announce them to our peers. There is a controlled transaction dissemination process that reveals our transactions to peers that has various safeguards for privacy (it's rate-limited, delayed & batched, deterministically sorted, ...), and ideally there is no way to test which transactions we have before that controlled process reveals them. The handling of the `mempool` BIP35 message has protections in this regard as well, as it would be an obvious way to bypass these protections (handled asynchronously after a delay, also deterministically sorted).

  However, currently, if we receive a GETDATA for a transaction that we have not yet announced to the requester, we will still respond to it if it was announced to *some* other peer already (because it needs to be in `mapRelay`, which only happens on the first announcement). This is a slight privacy leak.

  Thankfully, this seems easy to solve: `setInventontoryTxToSend` keeps track of the txids we have yet to announce to a peer - which almost(*) exactly corresponds to the transactions we know of that we haven't revealed to that peer. By checking whether a txid is in that set before responding to a GETDATA, we can filter these out.

  (*) Locally resubmitted or rebroadcasted transactions may end up in setInventoryTxToSend while the peer already knows we have them, which could result in us incorrectly claiming we don't have such transactions if coincidentally requested right after we schedule reannouncing them, but before they're actually INVed. This is made even harder by the fact that filterInventoryKnown will generally keep known reannouncements out of setInventoryTxToSend unless it overflows (which needs 50000 INVs in either direction before it happens).

  The condition for responding now becomes:

  ```
    (not in setInventoryTxToSend) AND
    (
      (in relay map) OR
      (
        (in mempool) AND
        (old enough that it could have expired from relay map) AND
        (older than our last getmempool response)
      )
    )
  ```

ACKs for top commit:
  naumenkogs:
    utACK 2896c41
  ajtowns:
    ACK 2896c412fadbc03916a33028f4f50fd87ac48edb
  amitiuttarwar:
    code review ACK 2896c412fa
  jonatack:
    ACK 2896c412fadbc03916 per `git diff 2b3f101 2896c41` only change since previous review is moving the recency check up to be verified first in `FindTxForGetData`, as it was originally in 353a391 (good catch), before looking up the transaction in the relay pool.
  jnewbery:
    code review ACK 2896c412fadbc03916a33028f4f50fd87ac48edb

Tree-SHA512: e7d5bc006e626f60a2c108a9334f3bbb67205ace04a7450a1e4d4db1d85922a7589e0524500b7b4953762cf70554c4a08eec62c7b38b486cbca3d86321600868
2023-12-03 20:01:26 -06:00
fanquake
0ecae66fe4 Merge #18931: net: use CMessageHeader::HEADER_SIZE, add missing include
83da576f4416c64b5d520819208a722b2273739a net: use CMessageHeader::HEADER_SIZE, add missing include (Jon Atack)

Pull request description:

  as suggested 16 months ago by Gleb Naumenko in https://github.com/bitcoin/bitcoin/pull/15197#issuecomment-456181865.

  `static constexpr CMessageHeader::HEADER_SIZE` is already used in this file, `src/net.cpp`, in 2 instances. This commit replaces the remaining 2 integer values in the file with it and adds the explicit include header.

  Co-authored by: Gleb Naumenko <naumenko.gs@gmail.com>

ACKs for top commit:
  naumenkogs:
    utACK 83da576
  practicalswift:
    ACK 83da576f4416c64b5d520819208a722b2273739a -- patch looks correct
  theStack:
    ACK 83da576f4416c64b5d520819208a722b2273739a -- verified that its just magic number elimination refactoring and additionally checked that all tests pass 👍

Tree-SHA512: 5b915483bca4ea162c259865a1b615d73b88a1b1db3f82db05f770d10b8a42494d948f5b21badbcce2d9efa5915b8cbb6af83073867c23d2f152c0d35ac37b96
2023-12-03 20:01:26 -06:00
Wladimir J. van der Laan
ec11695199 Merge #18962: net processing: Only send a getheaders for one block in an INV
746736639e6d05acdb85c866d4c605c947d4c500 [net processing] Only send a getheaders for one block in an INV (John Newbery)

Pull request description:

  Headers-first is the primary method of announcement on the network. If a node fell back sending blocks by inv, it's probably for a re-org. The final block hash provided should be the highest, so send a getheaders and then fetch the blocks we need to catch up.

  Sending many GETHEADERS messages to the peer would cause them to send a large number of potentially large HEADERS messages with redundant data, which is a waste of bandwidth.

ACKs for top commit:
  sipa:
    utACK 746736639e6d05acdb85c866d4c605c947d4c500
  mzumsande:
    utACK 746736639e6d05acdb85c866d4c605c947d4c500 as per ajtowns' reasoning.
  naumenkogs:
    utACK 7467366
  ajtowns:
    ACK 746736639e6d05acdb85c866d4c605c947d4c500
  jonatack:
    ACK 746736639e6d05acdb85c866d4c605c947d4c500

Tree-SHA512: 59e243b80d3f0873709dfacb2e4ffba34689aad7de31ec7f69a64e0e3a0756235a0150e4082ff5de823949ba4411ee1aed2344b4749b62e0eb1ea906e41f5ea9
2023-12-03 20:01:26 -06:00
Konstantin Akimov
5035a1cc4a Merge #18610: scripted-diff: test: replace command with msgtype (naming) 2023-12-03 20:01:26 -06:00
MarcoFalke
738d6b1c70 Merge #19304: test: Check that message sends successfully when header is split across two buffers
80d4423f997e15780bfa3f91bf4b4bf656b8ea45 Test buffered valid message (Troy Giorshev)

Pull request description:

  This PR is a tweak of #19302.  This sends a valid message.

  Additionally, this test includes logging in the same vein as #19272.

ACKs for top commit:
  MarcoFalke:
    tested ACK 80d4423f997e15780bfa3f91bf4b4bf656b8ea45 (added an assert(false) to observe deterministic coverage) 🌦
  gzhao408:
    ACK 80d4423f99 👊

Tree-SHA512: 3b1aa5ec480a1661917354788923d64595e2886448c9697ec0606a81293e8b4a4642b2b3cc9afb2206ce6f74e5c6d687308c5ad19cb73c5b354d3071ad8496f8
2023-12-03 20:01:26 -06:00
Konstantin Akimov
b292c41eea partial Merge #18628: test: Add various low-level p2p tests
Adds missing changes from p2p_invalid_tx.py but one assert is still disabled

fa4c29bc1d2425f861845bae4f3816d9817e622a test: Add various low-level p2p tests (MarcoFalke)

Pull request description:

ACKs for top commit:
  jonatack:
    ACK fa4c29bc1d242

Tree-SHA512: 842821b97359d4747c763398f7013415858c18a300cd882887bc812d039b5cbb67b9aa6f68434575dbc3c52f7eb8c43d1b293a59555a7242c0ca615cf44dc0aa
2023-12-03 20:01:26 -06:00
Konstantin Akimov
b43af81199
fix: assertion in CMNHFManager due to missing data in evoDB (#5736)
Prior required changes: bitcoin/bitcoin#19438 from
https://github.com/dashpay/dash/pull/5740

## Issue being fixed or feature implemented
Assertion failure:
```
  assertion: ok
  file: evo/mnhftx.cpp, line: 287
  function: AbstractEHFManager::Signals CMNHFManager::GetFromCache(const CBlockIndex*)
No debug information available for stacktrace. You should add debug information and then run: dash-qt -printcrashinfo=bvcgc43iinzgc43ijfxgm3ybaadwiyltnawxc5e3ifzxgzlsoruw63ramzqws3dvojstucraebqxg43foj2gs33ohiqg62ykeaqgm2lmmu5cazlwn4xw23timz2hqltdobycyidmnfxgkoragi4docraebthk3tdoruw63r2ebawe43uojqwg5cfjbde2ylomftwk4r2hjjwsz3omfwhgicdjvheqrsnmfxgcz3foi5dur3fordhe33ninqwg2dffbrw63ttoqqegqtmn5rwwslomrsxqkrjbyrelhyaaaaaaaedgkiaaaaaaaadsm4qaaaaaaaa7gpyqaaaaaaaa2njraaaaaaaadkl3caaaaaaaabhxznqaaaaaaadqa2eaaaaaaaax33twaaaaaaabwaihqaaaaaaac7yooqbaaaaaahba45qcaaaaaacwkz2aeaaaaaaeitgeaiaaaaaaaa=
dash-qt: evo/mnhftx.cpp:287: AbstractEHFManager::Signals CMNHFManager::GetFromCache(const CBlockIndex*): Assertion `ok' failed.
```

This can happen in case if Dash Core has been update from v19 (or
earlier v20.alphaX) to v20.0.0 after v20 activation without re-indexing

## What was done?
`CMNHFManager` is visiting missing blocks recursively until reach first
v20 block or first block actually saved in evoDb.


Without changes from bitcoin/bitcoin#19438 there's an other issue:
```
2023-11-27T11:12:10Z POTENTIAL DEADLOCK DETECTED
Previous lock order was:
 (2) 'cs_main' in llmq/instantsend.cpp:459 (in thread 'isman')
 (1) 'cs_llmq_vbc' in llmq/utils.cpp:711 (in thread 'isman')
Current lock order is:
 'cs_dip3list' in qt/masternodelist.cpp:135 (TRY) (in thread 'main')
 (1) 'cs_llmq_vbc' in llmq/utils.cpp:719 (in thread 'main')
 (2) 'cs_main' in node/blockstorage.cpp:77 (in thread 'main')
Assertion failed: detected inconsistent lock order for 'cs_main' in node/blockstorage.cpp:77 (in thread 'main'), details in debug log.
2023-11-27T11:12:10Z Posix Signal: Aborted
```

## How Has This Been Tested?
Run unit/functional test; run dash-qt on my local backup of problematic
storage (succeed without error); reindex testnet.

## Breaking Changes
N/A


## Checklist:
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
2023-12-01 12:59:27 -06:00