Commit Graph

39723 Commits

Author SHA1 Message Date
furszy
9f36e591c5
net: move state dependent peer services flags
No behavior change. Just an intermediate refactoring.

By relocating the peer desirable services flags into the peer
manager, we allow the connections acceptance process to handle
post-IBD potential stalling scenarios.

In the follow-up commit(s), the desirable service flags will be
dynamically adjusted to detect post-IBD stalling scenarios (such
as a +48-hour inactive node that must prefer full node connections
instead of limited peer connections because they cannot provide
historical blocks). Additionally, this encapsulation enable us
to customize the connections decision-making process based on
new user's configurations in the future.
2024-01-15 10:28:20 -03:00
furszy
f9ac96b8d6
net: decouple state independent service flags from desirable ones
This former one will be moved to the peer manager class in the
following-up commit.
2024-01-15 10:28:20 -03:00
furszy
97df4e3887
net: store best block tip time inside PeerManager
And implement 'ApproximateBestBlockDepth()' to estimate
the distance, in blocks, between the best-known block
and the network chain tip. Utilizing the best-block time
and the chainparams blocks spacing to approximate it.
2024-01-15 10:28:20 -03:00
glozow
dd391944dc
Merge bitcoin/bitcoin#28863: wallet, mempool: propagete checkChainLimits error message to wallet
8dec9c560b wallet, mempool: propagete `checkChainLimits` error message to wallet (ismaelsadeeq)

Pull request description:

  * Requested in [#28391 comment](https://github.com/bitcoin/bitcoin/pull/28391#discussion_r1382997719)

  * The error message is static when a new transaction is created and package limit is reached.
  `Transaction has too long of a mempool chain`
  While the [`CTxMempool::CheckPackageLimits`](5800c558eb/src/txmempool.cpp (L199)) provide explicit information about the error message.
  * This PR updates [`CTxMempool::CheckPackageLimits`](5800c558eb/src/txmempool.cpp (L199)) return type to `util::Result<void>`, `CheckPackageLimits` now returns void when package limit is not hit, and returns the error string whenever package limit is hit instead of using out parameter `errString`.
  * The PR updates [`checkChainLimits`](5800c558eb/src/node/interfaces.cpp (L703)) return type to `util::Result<void>`.

  * Now the wallet `CreateTransactionInternal` will have access to the package limit error string whenever its hit.
  * Also Updated functional test to reflect the error message from `CTxMempool::CheckPackageLimits` output.

ACKs for top commit:
  glozow:
    utACK 8dec9c560b
  Sjors:
    utACK 8dec9c560b
  TheCharlatan:
    Re-ACK 8dec9c560b

Tree-SHA512: ddeac18aeba6f8e3be0e3fe76bf3db655352e3b415169f1f83ea1e8976a2f3e3de021c8da6880eb8382ab52d545e418e3f4d57adcc68ecb4f390339710ee6f30
2023-12-18 15:35:11 +00:00
fanquake
eef19c4ce2
Merge bitcoin/bitcoin#29064: fuzz: Improve fuzzing stability for minisketch harness
b2fc7a2eda [fuzz] Improve fuzzing stability for minisketch harness (dergoegge)

Pull request description:

  The `minisketch` harness has low stability due to:
  * Rng internal to minisketch
  * Benchmarkning for the best minisketch impl

  Fix this by seeding the rng and letting the fuzzer choose the impl.

  Also see #29018.

ACKs for top commit:
  maflcko:
    review ACK b2fc7a2eda

Tree-SHA512: 3d81414299c6803c34e928a53bcf843722fa8c38e1d3676cde7fa80923f9058b1ad4b9a2941f718303a6641b17eeb28b4a22eda09678102e9fb7c4e31d06f8f2
2023-12-18 13:54:00 +00:00
fanquake
c840dea27e
Merge bitcoin/bitcoin#29078: build: Bump guix time-machine to unlock riscv64 metal
fa87a2072b build: Bump guix time-machine to unlock riscv64 metal (MarcoFalke)

Pull request description:

  Closes https://github.com/bitcoin/bitcoin/issues/29020

ACKs for top commit:
  fanquake:
    ACK fa87a2072b

Tree-SHA512: a4681f560ebab2f74c2dc8e5a9851d23c1f3fd7235b19343950afdc126d4bc77fc733fa852f55d18656ba592f37a9fff487d8af776f6b952eb4f52c1affa8ba4
2023-12-18 12:54:31 +00:00
fanquake
4b94578fd8
Merge bitcoin/bitcoin#29079: fuzz: Limit p2p fuzz targets to MAX_PROTOCOL_MESSAGE_LENGTH
fa769d3e41 fuzz: Limit p2p fuzz targets to MAX_PROTOCOL_MESSAGE_LENGTH (MarcoFalke)

Pull request description:

  Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65039

ACKs for top commit:
  dergoegge:
    utACK fa769d3e41
  brunoerg:
    crACK fa769d3e41

Tree-SHA512: 46f70d1acf4e2f95055c70162909010c6322f8504a810906e1ab4db470dc2525f9a494b8427b254279bc68b1c8b87338c943787fd5249df7113556740701a51a
2023-12-18 12:52:59 +00:00
fanquake
925a750d99
Merge bitcoin/bitcoin#28844: contrib: drop GCC MAX_VERSION to 4.3.0 in symbol-check
ff896d2581 contrib: drop GCC MAX_VERSION to 4.3.0 in symbol-check (fanquake)

Pull request description:

  Reflect the actual symbols used, i.e:

  ```bash
  bitcoind: symbol __bswapsi2 from unsupported version GCC_4.3.0(7)
  ```

ACKs for top commit:
  TheCharlatan:
    ACK ff896d2581

Tree-SHA512: b38ff8f4dd78d2d1c9063c53544dc4f240c3043f142e1581f7ba42f088a509293f6f17cc402c60ac82bff3b36668866b87e0e9e4d10d929484bb4c7a3e654f25
2023-12-18 12:48:14 +00:00
ismaelsadeeq
8dec9c560b wallet, mempool: propagete checkChainLimits error message to wallet
Update CheckPackageLimits to use util::Result to pass the error message
instead of out parameter.

Also update test to reflect the error message from `CTxMempool`
`CheckPackageLimits` output.
2023-12-17 21:13:44 +01:00
Ava Chow
3695ecbf68
Merge bitcoin/bitcoin#29088: tests: Don't depend on value of DEFAULT_PERMIT_BAREMULTISIG
7b45744df3 tests: ensure functional tests set permitbaremultisig=1 when needed (Anthony Towns)
7dfabdcf86 tests: test both settings for permitbaremultisig in p2sh tests (Anthony Towns)

Pull request description:

  Update unit and functional tests so that they continue to work if the default for `-permitbaremultisig` is changed.

ACKs for top commit:
  maflcko:
    lgtm ACK 7b45744df3
  instagibbs:
    crACK 7b45744df3
  ajtowns:
    > crACK [7b45744](7b45744df3)
  achow101:
    ACK 7b45744df3
  glozow:
    ACK 7b45744df3, changed default locally and all tests passed

Tree-SHA512: f89f9e2bb11f07662cfd57390196df9e531064e1bd662e1db7dcfc97694394ae5e8014e9d209b9405aa09195bf46fc331b7fba10378065cdb270cbd0669ae904
2023-12-15 16:22:54 -05:00
fanquake
9776186e9f
Merge bitcoin/bitcoin#29087: Update security.md contact for achow101
e7d66509dc Update security.md contact for achow101 (Ava Chow)

Pull request description:

ACKs for top commit:
  maflcko:
    lgtm ACK e7d66509dc
  0xB10C:
    ACK e7d66509dc

Tree-SHA512: 73247b612d1c2c99973de90edede0153de4cacbf9c66b87c07cb1429cb80a1b23fb497c7263494f05869605a0a5cd9b2173bc1c64c8beacb5990f69d39101168
2023-12-15 10:13:47 +00:00
Anthony Towns
7b45744df3 tests: ensure functional tests set permitbaremultisig=1 when needed
The mempool_dust and mempool_sigoplimits functional tests both use bare
multisig txs, so ensure they're allowed by policy.
2023-12-15 18:37:29 +10:00
Anthony Towns
7dfabdcf86 tests: test both settings for permitbaremultisig in p2sh tests 2023-12-15 18:37:24 +10:00
Ava Chow
e7d66509dc Update security.md contact for achow101 2023-12-14 18:14:54 -05:00
Ava Chow
1b2dedbf5c
Merge bitcoin/bitcoin#29040: refactor: Remove pre-C++20 code, fs::path cleanup
6666713041 refactor: Rename fs::path::u8string() to fs::path::utf8string() (MarcoFalke)
856c88776f ArgsManager: return path by value from GetBlocksDirPath() (Vasil Dimov)
fa3d9304e8 refactor: Remove pre-C++20 fs code (MarcoFalke)
fa00098e1a Add tests for C++20 std::u8string (MarcoFalke)
fa2bac08c2 refactor: Avoid copy/move in fs.h (MarcoFalke)
faea30227b refactor: Use C++20 std::chrono::days (MarcoFalke)

Pull request description:

  This:

  * Removes dead code.
  * Avoids unused copies in some places.
  * Adds copies in other places for safety.

ACKs for top commit:
  achow101:
    ACK 6666713041
  ryanofsky:
    Code review ACK 6666713041. Just documentation change since last review.
  stickies-v:
    re-ACK 6666713041

Tree-SHA512: 6176e44f30b310d51632ec2d3827c3819905d0ddc6a4b57acfcb6cfa1f9735176da75ee8ed4a4abd1296cb0b83bee9374cc6f91ffac87c19b63c435eeadf3f46
2023-12-14 16:46:54 -05:00
Ava Chow
08e6aaabef
Merge bitcoin/bitcoin#28920: wallet: birth time update during tx scanning
1ce45baed7 rpc: getwalletinfo, return wallet 'birthtime' (furszy)
83c66444d0 test: coverage for wallet birth time interaction with -reindex (furszy)
6f497377aa wallet: fix legacy spkm default birth time (furszy)
75fbf444c1 wallet: birth time update during tx scanning (furszy)
b4306e3c8d refactor: rename FirstKeyTimeChanged to MaybeUpdateBirthTime (furszy)

Pull request description:

  Fixing #28897.

  As the user may have imported a descriptor with a timestamp newer
  than the actual birth time of the first key (by setting 'timestamp=now'),
  the wallet needs to update the birth time when it detects a transaction
  older than the oldest descriptor timestamp.

  Testing Notes:
  Can cherry-pick the test commit on top of master. It will fail there.

ACKs for top commit:
  Sjors:
    re-utACK 1ce45baed7
  achow101:
    ACK 1ce45baed7

Tree-SHA512: 10c2382f87356ae9ea3fcb637d7edc5ed0e51e13cc2729c314c9ffb57c684b9ac3c4b757b85810c0a674020b7287c43d3be8273bcf75e2aff0cc1c037f1159f9
2023-12-14 16:27:40 -05:00
Ava Chow
4ad5c71adb
Merge bitcoin/bitcoin#28051: Get rid of shutdown.cpp/shutdown.h, use SignalInterrupt directly
6db04be102 Get rid of shutdown.cpp/shutdown.h, use SignalInterrupt directly (Ryan Ofsky)
213542b625 refactor: Add InitContext function to initialize NodeContext with global pointers (Ryan Ofsky)
feeb7b816a refactor: Remove calls to StartShutdown from KernelNotifications (Ryan Ofsky)
6824eecaf1 refactor: Remove call to StartShutdown from stop RPC (Ryan Ofsky)
1d92d89edb util: Get rid of uncaught exceptions thrown by SignalInterrupt class (Ryan Ofsky)
ba93966368 refactor: Remove call to ShutdownRequested from IndexWaitSynced (Ryan Ofsky)
42e5829d97 refactor: Remove call to ShutdownRequested from HTTPRequest (Ryan Ofsky)
73133c36aa refactor: Add NodeContext::shutdown member (Ryan Ofsky)
f4a8bd6e2f refactor: Remove call to StartShutdown from qt (Ryan Ofsky)
f0c73c1336 refactor: Remove call to ShutdownRequested from rpc/mining (Ryan Ofsky)
263b23f008 refactor: Remove call to ShutdownRequested from chainstate init (Ryan Ofsky)

Pull request description:

  This change drops `shutdown.h` and `shutdown.cpp` files, replacing them with a `NodeContext::shutdown` member which is used to trigger shutdowns directly. This gets rid of an unnecessary layer of indirection, and allows getting rid of the `kernel::g_context` global.

  Additionally, this PR tries to improve error handling of `SignalInterrupt` code by marking relevant methods `[[nodiscard]]` to avoid the possibility of uncaught exceptions mentioned https://github.com/bitcoin/bitcoin/pull/27861#discussion_r1255496707.

  Behavior is changing In a few cases which are noted in individual commit messages. Particularly: GUI code more consistently interrupts RPCs when it is shutting down, shutdown state no longer persists between unit tests, the stop RPC now returns an RPC error if requesting shutdown fails instead of aborting, and other failed shutdown calls now log errors instead of aborting.

  This PR is a net reduction in lines of code, but in some cases the explicit error handling and lack of global shutdown functions do make it more verbose. The verbosity can be seen as good thing if it discourages more code from directly triggering shutdowns, and instead encourages code to return errors or send notifications that could be translated into shutdowns. Probably a number of existing shutdown calls could just be replaced by better error handling.

ACKs for top commit:
  achow101:
    ACK 6db04be102
  TheCharlatan:
    Re-ACK 6db04be102
  maflcko:
    ACK 6db04be102 👗
  stickies-v:
    re-ACK 6db04be102

Tree-SHA512: 7a34cb69085f37e813c43bdaded1a0cbf6c53bd95fdde96f0cb45346127fc934604c43bccd3328231ca2f1faf712a7418d047ceabd22ef2dca3c32ebb659e634
2023-12-14 15:14:00 -05:00
dergoegge
b2fc7a2eda [fuzz] Improve fuzzing stability for minisketch harness
* Seed minisketch rng
* Use fuzzer chosen minisketch impl instead of benchmarking for the best
  impl
2023-12-14 20:10:21 +00:00
Ava Chow
9860471708
Merge bitcoin/bitcoin#29070: test: add TestNode wait_until helper
bf0f7dbec6 test: add TestNode wait_until helper (Nikodemas Tuckus)

Pull request description:

  Add `wait_until` method that wraps the `wait_until_helper_internal` call.

  Closes https://github.com/bitcoin/bitcoin/issues/29029.

ACKs for top commit:
  maflcko:
    lgtm ACK bf0f7dbec6
  mohamedawnallah:
    LGTM! Code Review ACK bf0f7dbec6
  achow101:
    ACK bf0f7dbec6
  BrandonOdiwuor:
    Code review ACK bf0f7dbec6

Tree-SHA512: 05aab589c814f51a14e1483eb57c10b88385714e3eb2d0973c0ee2877f2b963a76837f34215fe2e6bd1c8d735f5af7dd2098331e1eda28587f39e513bc6e1a6a
2023-12-14 14:19:16 -05:00
Ava Chow
4d7b787ad6
Merge bitcoin/bitcoin#29022: Make bitcoin-tx replaceable value optional
98afe78661 doc: Update bitcoin-tx replaceable documentation (Kashif Smith)
94feaf2b66 tests: Add unit tests for bitcoin-tx replaceable command (Kashif Smith)
c2b836b119 bitcoin-tx: Make replaceable value optional (Kashif Smith)

Pull request description:

  This fixes #28638. The issue was originally raised by dooglus, who also suggested the patch found in this code. Additionally, test coverage has been added and documentation has been updated.

ACKs for top commit:
  achow101:
    ACK 98afe78661
  pinheadmz:
    ACK 98afe78661
  hernanmarino:
    Tested ACK 98afe78661
  instagibbs:
    untested ACK 98afe78661

Tree-SHA512: ea1384aba7b0014c8cbeb7280d66b1e617d406fb02471dff33873057132b80518c94c7caa4b0426c26d17ce8aa393107de319dde781ace8df72f0314c8c75159
2023-12-14 13:54:00 -05:00
MarcoFalke
6666713041
refactor: Rename fs::path::u8string() to fs::path::utf8string() 2023-12-14 16:22:40 +01:00
Hennadii Stepanov
e6dbf48c64
Merge bitcoin/bitcoin#29080: ci: Set HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK to avoid unrelated failures
43c3246af7 ci: Set `HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK` to avoid failures (Hennadii Stepanov)

Pull request description:

  Homebrew attempts to check for outdated dependents or those with broken linkage. Such behavior might lead to failures when Homebrew updates them on old macOS images. For example, https://github.com/bitcoin/bitcoin/actions/runs/7199058794/job/19609891263 using the macOS image version `20231025.2`.

  This PR prevents such behavior.

ACKs for top commit:
  maflcko:
    lgtm ACK 43c3246af7
  ismaelsadeeq:
    re ACK 43c3246af7

Tree-SHA512: cbe3cef5adf3f00eb618ba17aad3dc76c0c5d11142122a26b93619ae47dc50771e9e095caa898213325ed6ff41c07119429c0a9094bb98ead5601855d07bb2ea
2023-12-14 13:30:32 +00:00
Hennadii Stepanov
43c3246af7
ci: Set HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK to avoid failures
Homebrew attempts to check for outdated dependents or those with broken
linkage. Such behavior might lead to failures when Homebrew updates them
on old macOS images.

This change prevents such behavior.
2023-12-14 12:18:53 +00:00
MarcoFalke
fa769d3e41
fuzz: Limit p2p fuzz targets to MAX_PROTOCOL_MESSAGE_LENGTH 2023-12-14 12:39:02 +01:00
MarcoFalke
fa87a2072b
build: Bump guix time-machine to unlock riscv64 metal 2023-12-14 11:41:40 +01:00
Ava Chow
9f0f83d650
Merge bitcoin/bitcoin#29065: bench: wallet, fix change position out of range error
37c75c5820 test: wallet, fix change position out of range error (furszy)

Pull request description:

  Fixes #29061. Only the benchmark is affected.

  Since #25273, the behavior of 'inserting change at a random position'
  is instructed by passing ´std::nullopt´ instead of -1.

  Also, added missing documentation about the meaning of
  'change_pos=std::nullopt' inside 'CWallet::CreateTransaction()'

ACKs for top commit:
  achow101:
    ACK 37c75c5820
  kevkevinpal:
    ACK [37c75c5](37c75c5820)
  BrandonOdiwuor:
    ACK 37c75c5820

Tree-SHA512: d9a8d8533540455716a5090fcf407573cad9f0d0018a05f903f89e51620302f9b256318db6f7338b85c047f7fab372d724e916b1721d7ed302dbf3d845b08734
2023-12-13 12:45:30 -05:00
fanquake
019ec8a601
Merge bitcoin/bitcoin#29075: msvc: Fix test\config.ini content
f76e59d02e msvc: Fix `test\config.ini` content (Hennadii Stepanov)

Pull request description:

  This PR:
  1. Closes https://github.com/bitcoin/bitcoin/issues/29074.
  2. Enables the `tool_signet_miner.py` test.

ACKs for top commit:
  fanquake:
    ACK f76e59d02e

Tree-SHA512: d6e4f5b1c2018426b5b3e3239d7a2e993ae4f6598e4afc7ea484a1d2cb203b5a9fa011bbc5cbda5c596d84f99a632a776b21fa48a1ed70930fbbec0241782f93
2023-12-13 16:30:43 +00:00
Hennadii Stepanov
f76e59d02e
msvc: Fix test\config.ini content 2023-12-13 15:00:34 +00:00
fanquake
0830dcb313
Merge bitcoin/bitcoin#29066: Bump minimum required Boost version due to migration to C++20
49a90915aa build: Bump minimum required Boost to 1.73.0 to support C++20 (Hennadii Stepanov)

Pull request description:

  Boost versions <1.73 have C++20-specific bugs that were fixed in the following commits:
  - 15fcf21356
  - 495c095dc0

  I tested [`libboost1.71-dev`](https://packages.ubuntu.com/focal/libboost1.71-dev) in Ubuntu 20.04 and Boost 1.71, 1.72, 1.73 in our depends build system.

  Closes https://github.com/bitcoin/bitcoin/issues/29063.

ACKs for top commit:
  fanquake:
    ACK 49a90915aa

Tree-SHA512: b8ebc08af85abfa3fda70961bd1136ee9e5149dd76a3f901e43acba624d231971873cba5cbf30837f9e5ab58790b8330f241a76cb76d8cf5dce5ad0cca33fba8
2023-12-13 14:32:00 +00:00
fanquake
f0e829022a
Merge bitcoin/bitcoin#28967: build: disable external-signer for Windows
308aec3e56 build: disable external-signer for Windows (fanquake)
35537318a1 ci: remove --enable-external-signer from win64 job (fanquake)

Pull request description:

  It's come to light that Boost ASIO (a Boost Process sub dep) has in some
  instances, been quietly  initialising our network stack on Windows (see
  PR https://github.com/bitcoin/bitcoin/pull/28486 and discussion in https://github.com/bitcoin/bitcoin/issues/28940).

  This has been shielding a bug in our own code, but the larger issue
  is that Boost Process/ASIO is running code before main, and doing things
  like setting up networking. This undermines our own assumptions about
  how our binary works, happens before we run any sanity checks,
  and before we call our own code to setup networking. Note that ASIO also
  calls WSAStartup with version `2.0`, whereas we call with `2.2`.

  It's also not clear why a feature like external signer would have a
  dependency that would be doing anything network/socket related,
  given it only exists to spawn a local process.

  See also the discussion in https://github.com/bitcoin/bitcoin/issues/24907. Note that the maintaince of Boost Process in general,
  has not really improved. For example, rather than fixing bugs like https://github.com/boostorg/process/issues/111,
  i.e, https://github.com/boostorg/process/pull/317, the maintainer chooses to just wrap exception causing overflows
  in try-catch blocks: 0c42a58eac. These changes get merged in large,
  unreviewed PRs, i.e https://github.com/boostorg/process/pull/319.

  This PR disables external-signer on Windows for now. If, in future, someone
  changes how Boost Process works, or replaces it entirely with some
  properly reviewed and maintained code, we could reenable this feature on
  Windows.

ACKs for top commit:
  hebasto:
    re-ACK 308aec3e56.
  TheCharlatan:
    ACK 308aec3e56

Tree-SHA512: 7405f7fc9833eeaacd6836c4e5b1c1a7845a40c1fdd55c1060152f8d8189e4777464fde650e11eb1539556a75dddf49667105987078b1457493ee772945da66e
2023-12-13 11:55:21 +00:00
fanquake
8431a19537
Merge bitcoin/bitcoin#29068: test: Actually fail when a python unit test fails
fa0534d7e4 test: Actually fail when a python unit test fails (MarcoFalke)

Pull request description:

  Currently python unit test failures are ignored.

  Fix this.

ACKs for top commit:
  theStack:
    ACK fa0534d7e4
  BrandonOdiwuor:
    ACK fa0534d7e4

Tree-SHA512: c136be4c8d861d966f380e04d5d14b711b90c4011101302dae1332496e493207c5c673927586ed35b02b61a0b050bf45053a31e6ff766ec52f1d054caf0985e2
2023-12-13 11:23:59 +00:00
fanquake
54f6756e52
Merge bitcoin/bitcoin#28846: depends: fix libmultiprocess build on aarch64
bde8d63b17 depends: build libmultiprocess with position independant code (fanquake)
506634d79d depends: always install libmultiprocess to /lib (fanquake)
beb3096263 depends: always install capnp to /lib (fanquake)

Pull request description:

  Change to always install libmultiprocess into `lib/`. On some systems (my Fedora aarch64 box), libmultiprocess was being installed into `lib64/`, and then configure would fail to pick it up, because we only add `lib/` to pkgconfig/ldflags out of depends. Rather than adding lib64 to those, I opted for installing libmultiprocess into lib, with every other dependency we build.

  This was broken in our build after https://github.com/chaincodelabs/libmultiprocess/pull/79 upstream.

ACKs for top commit:
  ryanofsky:
    Code review ACK bde8d63b17. Only changes since last review were reverting the native_capnp change as suggested, and changing the order of the first two commits.

Tree-SHA512: ddd547e4ac224f2f199c569efd91104db7f2c243b124f9535aa0d9377315775ac566d699101580ce45ddd6676ad3e0c8cbe256334eeed9548205c2fa04d02102
2023-12-13 10:44:22 +00:00
Nikodemas Tuckus
bf0f7dbec6 test: add TestNode wait_until helper 2023-12-13 11:24:03 +01:00
fanquake
f48a789385
Merge bitcoin/bitcoin#28075: util: Remove DirIsWritable, GetUniquePath
fa3da629a1 Remove DirIsWritable, GetUniquePath (MarcoFalke)
fad3a9793b Return LockResult::ErrorWrite in LockDirectory (MarcoFalke)
fa0afe7408 refactor: Return enum in LockDirectory (MarcoFalke)

Pull request description:

  `GetUniquePath` is only used in tests and in `DirIsWritable`. The check by `DirIsWritable` is redundant with the check done in `LockDirectory`.

  Fix the redundancy by removing everything, except `LockDirectory`.

ACKs for top commit:
  TheCharlatan:
    Re-ACK fa3da629a1
  hebasto:
    ACK fa3da629a1, I have reviewed the code and it looks OK.

Tree-SHA512: e95f18cd586de7582e9c08ac7ddb860bfcfcbc8963804f45c5784c5e4c0598dc59ae7e45dd4daf30a5020dbf8433f5db2ad06e46a8676371982003790043c6c9
2023-12-13 10:06:16 +00:00
MarcoFalke
fa0534d7e4
test: Actually fail when a python unit test fails 2023-12-12 21:18:08 +01:00
Hennadii Stepanov
49a90915aa
build: Bump minimum required Boost to 1.73.0 to support C++20
Boost versions <1.73 have C++20-specific bugs that were fixed in the
following commits:
- 15fcf21356
- 495c095dc0
2023-12-12 19:59:52 +00:00
furszy
37c75c5820
test: wallet, fix change position out of range error
Since #25273, the behavior of 'inserting change at a random
position' is instructed by passing std::nullopt instead of -1.

Also, added missing documentation about the meaning of
'change_pos=std::nullopt' inside 'CWallet::CreateTransaction()'
2023-12-12 15:20:38 -03:00
Andrew Chow
d646ca35d9
Merge bitcoin/bitcoin#28994: wallet: skip BnB when SFFO is enabled
576bee88fd fuzz: disable BnB when SFFO is enabled (furszy)
05e5ff194c test: add coverage for BnB-SFFO restriction (furszy)
0c5755761c wallet: create tx, log resulting coin selection info (furszy)
5cea25ba79 wallet: skip BnB when SFFO is active (Murch)

Pull request description:

  Solves #28918. Coming from https://github.com/bitcoin/bitcoin/issues/28918#issuecomment-1838626406 discussion.

  The intention is to decouple only the bugfix relevant commits from #28985, allowing them to be included in the 26.x release. This way, we can avoid disabling the coin selection fuzzing test for an entire release.

  Note:
  Have introduced few changes to the bug fix commit so that the unit tests pass without the additional burden introduced in #28985.

ACKs for top commit:
  josibake:
    ACK 576bee88fd
  murchandamus:
    ACK 576bee88fd
  achow101:
    ACK 576bee88fd

Tree-SHA512: f5d90eb3f3f524265afe4719495c9bf30f98b9af26cf039f7df5a7db977abae72caa7a3478cdd0ab10cd143bc1662e8fc5286b5bc10fc10f0dd582a45b45c31a
2023-12-12 10:52:12 -05:00
fanquake
bde8d63b17
depends: build libmultiprocess with position independant code
This matches what we do with all other dependencies, see `--with-pic`,
and fixes build failures, like #26943.
2023-12-12 13:58:38 +00:00
fanquake
506634d79d
depends: always install libmultiprocess to /lib
On some systems, libmultiprocess would be installed into `lib64`, I
assume due to the use of GNUInstallDirs, however all other libs we build
in depends, go into lib/. Rather than adding lib64/ to the pkg-config
and link flags, I opted for always installing into lib/.

This was changed in
https://github.com/chaincodelabs/libmultiprocess/pull/79 upstream.

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
2023-12-12 13:58:38 +00:00
fanquake
beb3096263
depends: always install capnp to /lib
On some systems, capnp would be installed into `lib64`, I
assume due to the use of GNUInstallDirs, however all other libs we build
in depends, go into lib/. Rather than adding lib64/ to the pkg-config
and link flags, I opted for always installing into lib/.

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
2023-12-12 13:58:38 +00:00
fanquake
a7484be65f
Merge bitcoin/bitcoin#29059: Revert "ci: Only run functional tests on windows in master"
7b22cd80e0 Revert "ci: Only run functional tests on windows in master" (Hennadii Stepanov)

Pull request description:

  This PR reverts commit aba4a5887b from https://github.com/bitcoin/bitcoin/pull/28567.

  The Windows-specific code received [quality](https://github.com/bitcoin/bitcoin/pull/28486) and [performance](https://github.com/bitcoin/bitcoin/pull/29045) improvements recently. So there are no reasons to skip functional tests in PRs anymore.

  In my own repo, I've run the GHA Windows job more than 100 times with no failure.

ACKs for top commit:
  maflcko:
    lgtm ACK 7b22cd80e0
  TheCharlatan:
    ACK 7b22cd80e0

Tree-SHA512: 1e8687e8efe12db506e7cd2d5df9e48b5acb98a339f84684dd0fd67280e22227e2a5a206f1108b09e49038fab7a3ca2ffbd985677f00048c0962b39b2b9a2ba5
2023-12-12 13:43:06 +00:00
fanquake
60f677375e
Merge bitcoin/bitcoin#29055: tests, bench: Fix issue with CWallet::LoadWallet() being called in the wrong places
bd7f5d33e3 wallet: Assert that the wallet is not initialized in LoadWallet (Andrew Chow)
fb0b6ca4e5 tests, bench: Remove incorrect LoadWallet() calls (Andrew Chow)

Pull request description:

  `CWallet::LoadWallet()` expects to be called after a `CWallet` is constructed, but before any of its member functions called. Doing so invalidates pointers which causes issues with some PRs and branches that I am working on. This was being used incorrectly in a few tests and benchmarks, resulting in segfaults.

  As a precaution for this kind of issue in the future, I've also added a few asserts to `LoadWallet()` so that developers will notice when it is used incorrectly.

  As similar issue was fixed in #27666

ACKs for top commit:
  S3RK:
    ACK bd7f5d33e3
  furszy:
    ACK bd7f5d33

Tree-SHA512: 7664f12b8452994e7fc4d7d4f77697fb5f75edb0dba95ba99a4a23ec03d5b8e0ecbdcb7635547a0e8b4f89f708f98dcb5d039df0559e24b1ae411ed630e16e14
2023-12-12 11:47:34 +00:00
fanquake
7a283836eb
Merge bitcoin/bitcoin#29052: doc/reduce-traffic: update/clarify max outbound connection count
d58f89d355 doc: update/clarify max outbound connection count (Marnix)

Pull request description:

  closes https://github.com/bitcoin/bitcoin/issues/29046

ACKs for top commit:
  amitiuttarwar:
    ACK d58f89d355
  brunoerg:
    ACK d58f89d355

Tree-SHA512: 4f6e8596ceea0b655338b3fc90a465e319d81e2a006f22a98cd9acada9316e7eb2340e2f66b1b4dde4e63ae94f57efddec50478715608e1be3212b8e2d1c3a1a
2023-12-12 11:31:09 +00:00
fanquake
622e79e0fb
Merge bitcoin/bitcoin#29021: refactor: rpc: Pass CBlockIndex by reference instead of pointer
fa5989d514 refactor: rpc: Pass CBlockIndex by reference instead of pointer (MarcoFalke)
fa604eb6cf refactor: Use reference instead of pointer in IsBlockPruned (MarcoFalke)

Pull request description:

  Follow-up to https://github.com/bitcoin/bitcoin/pull/29003#issuecomment-1841435462

ACKs for top commit:
  TheCharlatan:
    ACK fa5989d514
  pablomartin4btc:
    tACK fa5989d514
  dergoegge:
    Code review ACK fa5989d514

Tree-SHA512: 7449de3e3bb435dcbf438df88df343bb70f6edc3228ee7c0078f912ffb415e951ba30f8ecad916765f8cf896f0d784fe30535c5cf997e303cf5af257ade69773
2023-12-12 10:47:04 +00:00
Hennadii Stepanov
7b22cd80e0
Revert "ci: Only run functional tests on windows in master"
This reverts commit aba4a5887b.
2023-12-12 10:04:49 +00:00
furszy
576bee88fd
fuzz: disable BnB when SFFO is enabled 2023-12-11 23:40:21 -03:00
furszy
05e5ff194c
test: add coverage for BnB-SFFO restriction
Verify the transaction creation process does not produce
a BnB solution when SFFO is enabled.
This is currently problematic because it could require a
change output. And BnB is specialized on changeless solutions.

Co-authored-by: Andrew Chow <achow101@gmail.com>
Co-authored-by: Murch <murch@murch.one>
2023-12-11 23:40:21 -03:00
Andrew Chow
bd7f5d33e3 wallet: Assert that the wallet is not initialized in LoadWallet
LoadWallet() cannot be run after the wallet has been initialized. So
assert that to avoid making this mistake in the future.
2023-12-11 17:03:25 -05:00
Andrew Chow
fb0b6ca4e5 tests, bench: Remove incorrect LoadWallet() calls
LoadWallet() must only be called immediately after a CWallet is
constructed, or not at all. Doing so after any other CWallet member
functions have been called may cause pointers and other objects
setup by other those functions to become invalidated.

Since these tests and benchmarks are using completely new wallets with
mock databases, it's not necessary to call LoadWallet() anyways, so
these can be dropped.
2023-12-11 17:03:25 -05:00