Commit graph

40909 commits

Author SHA1 Message Date
merge-script
ef09f535b7
Merge bitcoin/bitcoin#29984: net: Replace ifname check with IFF_LOOPBACK in Discover
a68fed111b net: Fix misleading comment for Discover (laanwj)
7766dd280d net: Replace ifname check with IFF_LOOPBACK in Discover (laanwj)

Pull request description:

  Checking the interface name is kind of brittle. In the age of network namespaces and containers, there is no reason a loopback interface can't be called differently.

  Check for the `IFF_LOOPBACK` flag to detect loopback interface instead.

  Also remove a misleading comment in Discover's doc comment.

ACKs for top commit:
  sipa:
    utACK a68fed111b
  willcl-ark:
    utACK a68fed111b
  theuni:
    utACK a68fed111b. Satoshi-era brittleness :)

Tree-SHA512: e2d7fc541f40f6a6af08286e7bcb0873ff55debdcd8b38b03f274897b673a6fb51d84d6c7241a02a9567ddf2645f50231d91bb1f55307ba7c6e68196c29b0edf
2024-05-07 10:28:58 +08:00
Ava Chow
63d0b930f8
Merge bitcoin/bitcoin#29845: rpc: return warnings as an array instead of just a single one
42fb5311b1 rpc: return warnings as an array instead of just a single one (stickies-v)

Pull request description:

  The RPC documentation for `getblockchaininfo`, `getmininginfo` and `getnetworkinfo` states that "warnings" returns "any network and blockchain warnings". In practice, only a single warning (i.e. the latest one that is set) is returned, the other ones are ignored.

  Fix that by returning all warnings as an array.

  As a side benefit, clean up the GetWarnings() logic.

  Since this PR changes the RPC result schema, I've added release notes. Users can temporarily revert to the old results by using `-deprecatedrpc=warnings`, until it's removed in a future version.

  ---

  Some historical context from git log:

  - when `GetWarnings` was introduced in 401926283a, it was used in the `getinfo` RPC, where only a [single error/warning was returned](401926283a (diff-7442c48d42cd5455a79915a0f00cce5e13359db46437a32b812876edb0a5ccddR250)) (similar to how it is now).
  - later on, "warnings" RPC response fields were introduced, e.g. in ef2a3de25c, with the description [stating](ef2a3de25c (diff-1021bd3c74415ad9719bd764ad6ca35af5dfb33b1cd863c0be49bdf52518af54R411)) that it returned "any network warnings" but in practice still only a single warning was returned

ACKs for top commit:
  achow101:
    re-ACK 42fb5311b1
  tdb3:
    Re ACK for 42fb5311b1
  TheCharlatan:
    ACK 42fb5311b1
  maflcko:
    ACK 42fb5311b1 🔺

Tree-SHA512: 4225ed8979cd5f030dec785a80e7452a041ad5703445da79d2906ada983ed0bbe7b15889d663d75aae4a77d92e302c93e93eca185c7bd47c9cce29e12f752bd3
2024-05-06 12:24:09 -04:00
merge-script
fdb41e08c4
Merge bitcoin/bitcoin#29773: build, bench, msvc: Add missing benchmarks
31a15f0aff bench: Disable WalletCreate* benchmarks when building with MSVC (Hennadii Stepanov)
23dc0c19ac msvc, bench: Add missing source files to bench_bitcoin project (Hennadii Stepanov)

Pull request description:

  On the master branch, the `bench_bitcoin.vcxproj` MSVC project misses wallet-specific source files.

  This PR fixes this issue.

  Benchmark run on Windows:
  ```
  > src\bench_bitcoin.exe -filter="CoinSelection|BnBExhaustion|Wallet.*"

  |               ns/op |                op/s |    err% |     total | benchmark
  |--------------------:|--------------------:|--------:|----------:|:----------
  |          398,800.00 |            2,507.52 |    1.5% |      0.01 | `BnBExhaustion`
  |          584,450.00 |            1,711.01 |    1.5% |      0.01 | `CoinSelection`
  |       86,603,650.00 |               11.55 |    0.4% |      1.91 | `WalletAvailableCoins`
  |            7,604.00 |          131,509.73 |    0.9% |      0.01 | `WalletBalanceClean`
  |          124,028.57 |            8,062.66 |    2.6% |      0.01 | `WalletBalanceDirty`
  |            7,587.12 |          131,802.30 |    1.9% |      0.01 | `WalletBalanceMine`
  |               48.58 |       20,583,872.99 |    0.9% |      0.01 | `WalletBalanceWatch`
  |        2,371,060.00 |              421.75 |    1.3% |      0.13 | `WalletCreateTxUseOnlyPresetInputs`
  |       96,861,760.00 |               10.32 |    0.9% |      5.31 | `WalletCreateTxUsePresetInputsAndCoinSelection`
  |              280.71 |        3,562,424.13 |    1.5% |      0.01 | `WalletIsMineDescriptors`
  |            1,033.47 |          967,618.32 |    0.3% |      0.01 | `WalletIsMineLegacy`
  |              282.36 |        3,541,599.91 |    0.5% |      0.01 | `WalletIsMineMigratedDescriptors`
  |      484,547,300.00 |                2.06 |    1.0% |      2.43 | `WalletLoadingDescriptors`
  |       29,924,300.00 |               33.42 |    0.4% |      0.15 | `WalletLoadingLegacy`
  ```

ACKs for top commit:
  maflcko:
    lgtm ACK 31a15f0aff

Tree-SHA512: 0241af06126edf612489322cdce66ba43792066b5400b1719a8b9d1ec62030e8a9d497e2f01e38290e94c387db59ccf2a458f4b35d3dc8030a1a1413d89eb792
2024-05-06 21:02:30 +08:00
merge-script
00ac1b963d
Merge bitcoin/bitcoin#29960: depends: pass verbose through to cmake based makefiles
7c69baf227 depends: pass verbose through to cmake based make (Max Edwards)

Pull request description:

  While testing https://github.com/bitcoin/bitcoin/pull/29708 I was not able to enable verbose output to check which flags were being given to the compiler.

  With this PR, running depends with V=1 will enable verbose output from makefiles generated by cmake.

  How to test:

  ```shell
  make -C depends libnatpmp V=1
  ```

ACKs for top commit:
  hebasto:
    ACK 7c69baf227. Tested using the folowing command:
  fanquake:
    ACK 7c69baf227

Tree-SHA512: 81cd1326e940c5f14cbde96735fd02b03c1150881ed88d1e8dfa9385dfa12284bfa2cdfe097ce5f43a726c1718afb76ae16f71552ab68c207d74fdc1f7bb46ae
2024-05-06 09:47:29 +08:00
merge-script
f7b81c7e1e
Merge bitcoin/bitcoin#30031: msvc: Compile test\fuzz\miniscript.cpp
9155b733e1 build, msvc: Compile test\fuzz\miniscript.cpp (Hennadii Stepanov)

Pull request description:

  This PR resolves the remained point from the https://github.com/bitcoin/bitcoin/pull/29774#issuecomment-2028808614:
  > What is the issue with the ... miniscript fuzz tests?

  From the CI [log](https://github.com/bitcoin/bitcoin/actions/runs/8941546183/job/24562123707?pr=30031#step:29:234):
  ```
  miniscript_script: succeeded against 721 files in 1s.
  Run miniscript_script with args ['D:\\a\\bitcoin\\bitcoin\\src\\fuzz.exe', WindowsPath('D:/a/_temp/qa-assets/fuzz_seed_corpus/miniscript_script')]
  miniscript_smart: succeeded against 1429 files in 2s.
  Run miniscript_smart with args ['D:\\a\\bitcoin\\bitcoin\\src\\fuzz.exe', WindowsPath('D:/a/_temp/qa-assets/fuzz_seed_corpus/miniscript_smart')]
  miniscript_stable: succeeded against 1871 files in 2s.
  Run miniscript_stable with args ['D:\\a\\bitcoin\\bitcoin\\src\\fuzz.exe', WindowsPath('D:/a/_temp/qa-assets/fuzz_seed_corpus/miniscript_stable')]
  miniscript_string: succeeded against 918 files in 3s.
  Run miniscript_string with args ['D:\\a\\bitcoin\\bitcoin\\src\\fuzz.exe', WindowsPath('D:/a/_temp/qa-assets/fuzz_seed_corpus/miniscript_string')]
  ```

ACKs for top commit:
  maflcko:
    ACK 9155b733e1
  TheCharlatan:
    ACK 9155b733e1

Tree-SHA512: 967f199aac41733265532518ff7b1d881ba5a7bbde9f827d6a0b6d984c94a65b20d5854ce0ea247158eaa17b21d4c9f7d25c79bac17960788bacd2586112630b
2024-05-06 09:33:56 +08:00
Hennadii Stepanov
9155b733e1
build, msvc: Compile test\fuzz\miniscript.cpp 2024-05-04 09:04:09 +01:00
merge-script
eb0bdbdd75
Merge bitcoin/bitcoin#28657: miniscript: make operator""_mst consteval
63317103c9 miniscript: make operator_mst consteval (Pieter Wuille)

Pull request description:

  It seems modern compilers don't realize that all invocations of operator""_mst can be evaluated at compile time, despite the `constexpr` keyword.

  Since C++20, we can force them to evaluate at compile time using `consteval`, turning all the miniscript type constants into actual compile-time constants.

  This should give a nice but not very important speedup for miniscript logic, but it's also a way to start testing C++20 features.

ACKs for top commit:
  hebasto:
    re-ACK 63317103c9.
  theuni:
    utACK 63317103c9

Tree-SHA512: bdc9f1a6499b8bb3ca04f1a158c31e6876ba97206f95ee5718f50efd58b5b4e6b8867c07f791848430bfaa130b9676d8a68320b763cda9a340c75527acbfcc9e
2024-05-04 09:13:11 +08:00
merge-script
61d3280c3a
Merge bitcoin/bitcoin#29907: test: Fix test/streams_tests.cpp compilation on SunOS / illumos
976e5d8f7b test: Fix `test/streams_tests.cpp` compilation on SunOS / illumos (Hennadii Stepanov)

Pull request description:

  On systems where `int8_t` is defined as `char`, the `{S,Uns}erialize(Stream&, signed char)` functions become undefined.

  This PR resolves the issue by testing `{S,Uns}erialize(Stream&, int8_t)` instead.

  No behavior change on systems where `int8_t` is defined as `signed char`, which is the case for most other systems.

  Fixes https://github.com/bitcoin/bitcoin/issues/29884.

  An alternative approach is mentioned in https://github.com/bitcoin/bitcoin/issues/29884#issuecomment-2058434577 as well.

ACKs for top commit:
  maflcko:
    lgtm ACK 976e5d8f7b
  theuni:
    ACK 976e5d8f7b. Nice to have the serialization concept actually tested :)

Tree-SHA512: 1033863e584fa8e99a281b236fa01fc919f610a024bcec792116762e28c1c16ee481bd01325c3a0ca9dd9d753176aa63bd9ac7e08a9bbce772db2949d06f6e61
2024-05-04 09:07:44 +08:00
merge-script
bd597c33e3
Merge bitcoin/bitcoin#25972: build: no-longer disable WARN_CXXFLAGS when CXXFLAGS is set
f0e22be69a build: no-longer disable WARN_CXXFLAGS when CXXFLAGS is set (fanquake)
b088062e68 ci: remove -Wdocumentation from -Werror in multiprocess CI (fanquake)
bec6a88fbc ci: remove -Warray-bounds from -Werror for win64 (fanquake)
7469ac7032 ci: disable -Werror=maybe-uninitialized for Windows builds (fanquake)

Pull request description:

  Now that `CXXFLAGS` are [back in user control](https://github.com/bitcoin/bitcoin/pull/24391), I don't think there's a
  reason to no-longer use our warning flags when `CXXFLAGS` has been
  overriden (this includes, by default, when building from depends).

  Anyone can suppress warnings from third-party code by
  passing the relevant `-Wno-` options in `CXXFLAGS`.

  Closes: #18092.

ACKs for top commit:
  maflcko:
    utACK f0e22be69a 🍡
  hebasto:
    ACK f0e22be69a.
  theuni:
    ACK f0e22be69a. It'll be nice to have this fixed.
  TheCharlatan:
    ACK f0e22be69a

Tree-SHA512: dcef4bd4a57bab6f586ca015fad725e7a38bf24b7a08808a74d8c8ca47cf68c5fca7b04ed38649a047c6929fb708e2c97f2000fc46d5a8d25da49951c5bb0f66
2024-05-04 08:47:18 +08:00
Ava Chow
f5b6f621ff
Merge bitcoin/bitcoin#30024: doc: replace remaining "520" magic nums with MAX_SCRIPT_ELEMENT_SIZE
ffc674595c Replace remaining "520" magic numbers with MAX_SCRIPT_ELEMENT_SIZE (Jon Atack)

Pull request description:

  Noticed these while reviewing BIPs yesterday.

  It would be clearer and more future-proof to refer to their constant name.

ACKs for top commit:
  instagibbs:
    ACK ffc674595c
  sipa:
    ACK ffc674595c
  achow101:
    ACK ffc674595c
  glozow:
    ACK ffc674595c, agree it's clearer for these comments to refer to the greppable name of the limit rather than the number

Tree-SHA512: 462afc1c64543877ac58cb3acdb01d42c6d08abfb362802f29f3482d75401a2a8adadbc2facd222a9a9fefcaab6854865ea400f50ad60bec17831d29f7798afe
2024-05-03 12:36:56 -04:00
Ava Chow
f9486de6a9
Merge bitcoin/bitcoin#30029: test: remove duplicate WITNESS_SCALE_FACTOR constant definition
af3c18169a [test]: remove duplicate WITNESS_SCALE_FACTOR (ismaelsadeeq)

Pull request description:

  Notice this while working on #29523

  - `blocktools.py` and `messages.py` both define `WITNESS_SCALE_FACTOR` constant

  99d7538cdb/test/functional/test_framework/blocktools.py (L48)

  99d7538cdb/test/functional/test_framework/messages.py (L68)
  - This PR deletes the one in `blocktools.py` and update the tests to only use `WITNESS_SCALE_FACTOR` from `messages.py`

ACKs for top commit:
  maflcko:
    ACK af3c18169a
  sipa:
    ACK af3c18169a
  achow101:
    ACK af3c18169a
  glozow:
    lgtm ACK af3c18169a
  brunoerg:
    ACK af3c18169a
  willcl-ark:
    ACK af3c18169a

Tree-SHA512: 6bd8060c9eea10e03940acee2aa4cd08e4e0afb6d26be3e6300ad405fd0af5b373a00e994eb39515a2dcafa1625562bcd57945049a84b9c9dcc7ea60c24f0911
2024-05-03 12:36:00 -04:00
Pieter Wuille
63317103c9 miniscript: make operator_mst consteval
It seems modern compilers don't realize that all invocations of operator""_mst
can be evaluated at compile time, despite the constexpr keyword.

Since C++20, we can force them to evaluate at compile time, turning all the
miniscript type constants into actual compile-time constants.

It appears that MSVC does not support consteval operator"" when used inside
certain expressions. For the few places where this happens, define a
constant outside the operator call.

Co-Authored-By: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2024-05-03 11:38:14 -04:00
Ryan Ofsky
70e4d6ff1d
Merge bitcoin/bitcoin#30026: refactor, test: Always initialize pointer
bd2de7ac59 refactor, test: Always initialize pointer (Hennadii Stepanov)

Pull request description:

  This change fixes MSVC warning [C4703](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4703).

  All `DisableSpecificWarnings` dropped from `test_bitcoin.vcxproj` as all remained are inherited from `common.init.vcxproj`.

  Required to simplify warning suppression porting to the CMake-based build system.

ACKs for top commit:
  maflcko:
    utACK bd2de7ac59
  sipsorcery:
    utACK bd2de7ac59.
  ryanofsky:
    Code review ACK bd2de7ac59

Tree-SHA512: 006db041d3c3697a77d9df14de86cf7c8a10804b45789df01268b2236cf6452e77dc57e89f5d5a6bc26d4b5cd483f0722d6035649c8a523b57954bb1fc810d0c
2024-05-03 09:54:52 -04:00
ismaelsadeeq
af3c18169a [test]: remove duplicate WITNESS_SCALE_FACTOR 2024-05-03 10:30:50 +01:00
fanquake
f0e22be69a
build: no-longer disable WARN_CXXFLAGS when CXXFLAGS is set
Now that CXXFLAGS are back in user control, I don't think there's a
reason to no-longer use our warning flags when CXXFLAGS has been
overriden (this includes when building from depends).

Anyone can suppress warnings from third-party code by
passing the relevant `-Wno-` options in CXXFLAGS.

Fixes: #18092.
2024-05-03 15:31:54 +08:00
fanquake
b088062e68
ci: remove -Wdocumentation from -Werror in multiprocess CI
The issues here are coming from Boost Test code.
2024-05-03 15:31:54 +08:00
fanquake
bec6a88fbc
ci: remove -Warray-bounds from -Werror for win64
These warnings are coming from leveldb, and appear to be fixed starting
with GCC 13.
2024-05-03 15:31:54 +08:00
fanquake
7469ac7032
ci: disable -Werror=maybe-uninitialized for Windows builds
This produces false positives, such as:
```bash
torcontrol.cpp: In static member function ‘static void TorControlConnection::readcb(bufferevent*, void*)’:
torcontrol.cpp:94:28: error: ‘result’ may be used uninitialized [-Werror=maybe-uninitialized]
   94 |         self->message.code = ToIntegral<int>(s.substr(0, 3)).value_or(0);
      |         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./netaddress.h:18,
                 from ./torcontrol.h:11,
                 from torcontrol.cpp:6:
./util/strencodings.h:184:7: note: ‘result’ was declared here
  184 |     T result;
      |       ^~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:11088: libbitcoin_node_a-torcontrol.o] Error 1
```
2024-05-03 15:31:54 +08:00
merge-script
99d7538cdb
Merge bitcoin/bitcoin#30012: opportunistic 1p1c followups
7f6fb73c82 [refactor] use reference in for loop through iters (glozow)
6119f76ef7 Process every MempoolAcceptResult regardless of PackageValidationResult (glozow)
2b482dc1f3 [refactor] have ProcessPackageResult take a PackageToValidate (glozow)
c2ada05307 [doc] remove redundant PackageToValidate comment (glozow)
9a762efc7a [txpackages] use std::lexicographical_compare instead of sorting hex strings (glozow)
8496f69e1c [refactor] make MempoolAcceptResult::m_replaced_transactions non-optional (glozow)

Pull request description:

  Followups from #28970:
  - https://github.com/bitcoin/bitcoin/pull/28970#discussion_r1568781077
  - https://github.com/bitcoin/bitcoin/pull/28970#discussion_r1585554972
  - https://github.com/bitcoin/bitcoin/pull/28970#discussion_r1581019326
  - https://github.com/bitcoin/bitcoin/pull/28970#discussion_r1581036209
  - https://github.com/bitcoin/bitcoin/pull/28970#discussion_r1586258730

ACKs for top commit:
  instagibbs:
    reACK 7f6fb73c82

Tree-SHA512: 9d8393d5f2fedbc6ebce582ff2a8ed074a02dd8e7dbf562c14d48b439fdc1ee6c3203b3609366d3c883d44655cc1a5c83a75ca56e490d25c1a34d95a0622d458
2024-05-03 15:31:06 +08:00
merge-script
5127844cab
Merge bitcoin/bitcoin#30017: refactor, fuzz: Make 64-bit shift explicit
b50d127a77 refactor: Make 64-bit shift explicit (Hennadii Stepanov)

Pull request description:

  This PR fixes MSVC warning [C4334](https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4334) in the fuzzing code. Similar to https://github.com/bitcoin/bitcoin/pull/26252.

  All `DisableSpecificWarnings` dropped from `fuzz.vcxproj` as all remained are inherited from `common.init.vcxproj`.

  Required to simplify warning suppression porting to the CMake-based build system.

ACKs for top commit:
  maflcko:
    utACK b50d127a77
  sipsorcery:
    utACK b50d127a77

Tree-SHA512: 18f6082b4234506ad2f9df54e577031b97cdf9f7ef64cad4162f275660716ab73587a97d3af0f778dfd48d2751d8676b5d3381d0aa837fcc60a09704473a9209
2024-05-03 10:47:37 +08:00
Hennadii Stepanov
bd2de7ac59
refactor, test: Always initialize pointer
This change fixes MSVC warning C4703.
See: https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4703

All `DisableSpecificWarnings` dropped from `test_bitcoin.vcxproj` as all
remained are inherited from `common.init.vcxproj`.
2024-05-02 23:10:05 +01:00
Ava Chow
62ef33a718
Merge bitcoin/bitcoin#29617: test: Validate UTXO snapshot with coin height > base height & amount > MAX_MONEY supply
ec1f1abfef test:Validate UTXO snapshot with coin_height > base_height & amount > money_supply (jrakibi)

Pull request description:

  ### Ensure snapshot loading fails for coins exceeding base height

  **Objective**: This test verifies that snapshot loading is correctly rejected for coins with a height greater than the base height.

  **Update**:
  - Added `test_invalid_snapshot_wrong_coin_code` to `feature_assumeutxo.py`.
  - The test artificially sets a coin's height above 299 in a snapshot and checks for load failure.
  - Edit: Added a test case for outputs whose amounts surpass the MAX_MONEY supply limit.

  This implementation addresses the request for enhancing `assumeutxo` testing as outlined in issue #28648

  ---

  **Edit: This is an explanation on how I arrive at content values: b"\x84\x58" and b"\xCA\xD2\x8F\x5A"**

  You can use this tool to decode the utxo snapshot https://github.com/jrakibi/utxo-live
  Here’s an overview of how it’s done:
  The serialization format for a UTXO in the snapshot is as follows:
  1. Transaction ID (txid) - 32 bytes
  2. Output Index (outnum)- 4 bytes
  3. VARINT (code) - A varible-length integer encoding the height and whether the transaction is a coinbase. The format of this VARINT is (height << 1) | coinbase_flag.
  4. VARINT (amount_v) - A variable-length integer that represents a compressed format of the output amount (in satoshis).

  For the test cases mentioned:
  * **`b"\x84\x58"`** - This value corresponds to a VARINT representing the height and coinbase flag. Once we decode this code, we can extract the height and coinbase using `height = code_decoded >> 1` and `coinbase = code_decoded & 0x01`. In our case, with code_decoded = 728, it results in `height = 364` and `coinbase = 0`.
  * **`b"\xCA\xD2\x8F\x5A"`** - This byte sequence represents a compressed amount value. The decompression function takes this value and translates it into a full amount in satoshis. In our case, the decompression of this amount translates to a number larger than the maximum allowed value of coins (21 million BTC)

ACKs for top commit:
  fjahr:
    re-ACK ec1f1abfef
  maflcko:
    ACK ec1f1abfef 👑
  achow101:
    ACK ec1f1abfef

Tree-SHA512: 42b36fd1d76e9bc45861028acbb776bd2710c5c8bff2f75c751ed505995fbc1d4bc698df3be24a99f20bcf6a534615d2d9678fb3394162b88133eaec88ca2120
2024-05-02 16:45:42 -04:00
Ava Chow
81174d8a9b
Merge bitcoin/bitcoin#29961: refactor: remove remaining unused code from cpp-subprocess
8b52e7f628 update comments in cpp-subprocess (check_output references) (Sebastian Falbesoner)
97f159776e remove unused method `Popen::kill` from cpp-subprocess (Sebastian Falbesoner)
908c51fe4a remove commented out code in cpp-subprocess (Sebastian Falbesoner)
ff79adbe05 remove unused templates from cpp-subprocess (Sebastian Falbesoner)

Pull request description:

  This PR removes remaining code that is unused within the cpp-subprocess module (templates and commented out code). Happy to add more removals if anyone finds more unused parts. Note that there are some API functions of the `Popen` class that we don't use, e.g. `wait()`, `pid()`, `poll()`, `kill()`, but they sound IMHO common enough to be useful in the future, so not sure how deep we should go there.

ACKs for top commit:
  fjahr:
    Code review ACK 8b52e7f628
  achow101:
    ACK 8b52e7f628
  hebasto:
    ACK 8b52e7f628.

Tree-SHA512: 14c1cd2216185d941923f06fdc7acbeed66cd87e2691d9a352f7309b3e07fe4877b580f598a2e4106f9c48395ed6de00a0bfb5d3c3af9c4624d1956a0f543e99
2024-05-02 16:33:18 -04:00
Jon Atack
ffc674595c Replace remaining "520" magic numbers with MAX_SCRIPT_ELEMENT_SIZE 2024-05-02 13:16:40 -06:00
merge-script
3d28725134
Merge bitcoin/bitcoin#29968: refactor: Avoid unused-variable warning in init.cpp
fa9abf9688 refactor: Avoid unused-variable warning in init.cpp (MarcoFalke)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/pull/27679#discussion_r1580606777

ACKs for top commit:
  TheCharlatan:
    ACK fa9abf9688

Tree-SHA512: dcf56d7aa68578ba611a2dc591de036ab1d08f7f4dfb35d325ecf7241d8e17abc0af7005b96c44da9777adc36961b4da7fdde282a1ab0e0a6f229c8108923101
2024-05-02 21:09:14 +08:00
MarcoFalke
fa9abf9688
refactor: Avoid unused-variable warning in init.cpp 2024-05-02 12:37:24 +02:00
glozow
7f6fb73c82 [refactor] use reference in for loop through iters 2024-05-02 11:24:36 +01:00
merge-script
9d1a286f20
Merge bitcoin/bitcoin#29934: doc: add LLVM instruction for macOS < 13
22574046c9 doc: add LLVM instruction for macOS < 13 (Sjors Provoost)

Pull request description:

  #29208 bumped clang to 14, which users of old macOS versions need to install manually. This PR adds instructions.

  Xcode 14.3.1 ships clang 14.0.3 (14.0.0 is broken, see #29918):
  https://en.wikipedia.org/wiki/Xcode#Xcode_11.0_-_14.x_(since_SwiftUI_framework)

  The system requirements for that is macOS Ventura 13.0 or later: https://developer.apple.com/documentation/xcode-release-notes/xcode-14_3_1-release-notes#

  Homebrew itself officially supports macOS 12 or later, but _may_ still work on macOS 11: https://docs.brew.sh/Installation

  Fwiw macOS 11 Big Sur last got an update in September 2023, so Apple has not _entirely_ written it off: https://en.wikipedia.org/wiki/MacOS_Big_Sur

ACKs for top commit:
  maflcko:
    utACK 22574046c9
  TheCharlatan:
    ACK 22574046c9

Tree-SHA512: 5b4bcc71966d1da84bc4da32da89e0dea9f519f37d9e14e169140c92af044b33f404f01ae7d10f53ab5345dd51ac404c161389efef93da5cacbfd52a43881695
2024-05-02 15:27:25 +08:00
merge-script
59b773f42a
Merge bitcoin/bitcoin#30010: lint: [doc] Clarify Windows line endings (CR LF) not to be used
fa9be2f795 lint: [doc] Clarify Windows line endings (CR LF) not to be used (MarcoFalke)

Pull request description:

  It has been this case since the linter was introduced years ago. Given a misunderstanding (https://github.com/bitcoin/bitcoin/pull/28074#issuecomment-2088028856), clarify the docs.

ACKs for top commit:
  brunoerg:
    ACK fa9be2f795

Tree-SHA512: be714db9df533e0962ed84102ffdb72717902949b930d58cf5a79cba36297f6b2b1f75e65a2c1f46bcb8e2f4ad5d025f3d15210f468a5ec9631a580b74f923ea
2024-05-02 11:45:23 +08:00
merge-script
1cc3aa4d21
Merge bitcoin/bitcoin#29707: depends: build miniupnpc with CMake
5195baa600 depends: fix miniupnpc snprintf usage on Windows (fanquake)
3c2d440f14 depends: switch miniupnpc to CMake (Cory Fields)
f5618c79d9 depends: add upstream CMake patch to miniupnpc (fanquake)
6866b571ab depends: miniupnpc 2.2.7 (fanquake)

Pull request description:

  This picks up one of the changes from #29232, which is a switch to building miniupnpc with CMake. It includes an update to the most recent version of miniupnpc (2.2.7), which means we can drop one patch from that commit, and includes a new patch for a change I've upstreamed https://github.com/miniupnp/miniupnp/pull/721, as well as some suggestions from the previous PR.

ACKs for top commit:
  theuni:
    ACK 5195baa600.
  TheCharlatan:
    utACK 5195baa600

Tree-SHA512: 5b27e132cd5eed285e9be34c8b96893417d92a1ae55c99345c9a89e1c1c5e40e4bc840bc061b879758b2b11fcb520cd98c3da985c1e153f2e5380cf63efe2d69
2024-05-02 11:21:24 +08:00
Hennadii Stepanov
b50d127a77
refactor: Make 64-bit shift explicit
This change fixes MSVC level-3 warning C4334.
See: https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4334

All `DisableSpecificWarnings` dropped from `fuzz.vcxproj` as all
remained are inherited from `common.init.vcxproj`.
2024-05-02 00:16:33 +01:00
merge-script
d73245abc7
Merge bitcoin/bitcoin#29120: test: Add test case for spending bare multisig
e504b1fa1f test: Add test case for spending bare multisig (Brandon Odiwuor)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/29113

ACKs for top commit:
  ajtowns:
    ACK e504b1fa1f ; LGTM and just checking the 1-of-3 case seems fine
  maflcko:
    utACK e504b1fa1f
  achow101:
    ACK e504b1fa1f
  willcl-ark:
    reACK e504b1fa1f

Tree-SHA512: 641a12599efa34e1a3eb65b125318df326628fef3e6886410ea9e63a044664fad7bcad46d1d6f41ddc59630746b9963cedb569c2682b5940b32b9225883da8f2
2024-05-01 14:43:58 -04:00
stickies-v
42fb5311b1
rpc: return warnings as an array instead of just a single one
The RPC documentation for `getblockchaininfo`, `getmininginfo` and
`getnetworkinfo` states that "warnings" returns "any network and
blockchain warnings". In practice, only a single warning is returned.

Fix that by returning all warnings as an array.

As a side benefit, cleans up the GetWarnings() logic.
2024-05-01 14:44:57 +01:00
glozow
6119f76ef7 Process every MempoolAcceptResult regardless of PackageValidationResult 2024-05-01 13:48:03 +01:00
glozow
2b482dc1f3 [refactor] have ProcessPackageResult take a PackageToValidate 2024-05-01 13:38:19 +01:00
glozow
c2ada05307 [doc] remove redundant PackageToValidate comment 2024-05-01 13:35:12 +01:00
glozow
9a762efc7a [txpackages] use std::lexicographical_compare instead of sorting hex strings
No behavior change, but getting the hex string is more expensive than
necessary.
2024-05-01 13:34:37 +01:00
glozow
8496f69e1c [refactor] make MempoolAcceptResult::m_replaced_transactions non-optional 2024-05-01 13:34:37 +01:00
MarcoFalke
fa9be2f795
lint: [doc] Clarify Windows line endings (CR LF) not to be used 2024-05-01 08:12:40 +02:00
Ava Chow
842f7fdf78
Merge bitcoin/bitcoin#29645: doc: update release-process.md
1ea8674316 [doc] update release-process.md and backports section of CONTRIBUTING (glozow)

Pull request description:

  While doing various release process things for the first time, I noticed some of our docs are outdated and/or confusing.

ACKs for top commit:
  achow101:
    ACK 1ea8674316

Tree-SHA512: 4ad10d4ce2c33fe15cb02599353107bb72ecb867aefc6c120cfd5cdea42aa8fa3783f9e0218c2f3815f030e0694cc8fb24011ce88358a0206cb07416a256a962
2024-04-30 20:17:04 -04:00
Ava Chow
4df2d0c4ce
Merge bitcoin/bitcoin#29983: msvc: Compile test\fuzz\bitdeque.cpp
774359b4a9 build, msvc: Compile `test\fuzz\bitdeque.cpp` (Hennadii Stepanov)
85f50a46c5 refactor: Fix "error C2248: cannot access private member" on MSVC (Hennadii Stepanov)

Pull request description:

  This PR resolves one point from the https://github.com/bitcoin/bitcoin/pull/29774#issuecomment-2028808614:
  > What is the issue with the bitdeque... ?

ACKs for top commit:
  maflcko:
    lgtm ACK 774359b4a9
  sipa:
    utACK 774359b4a9
  achow101:
    ACK 774359b4a9
  dergoegge:
    utACK 774359b4a9

Tree-SHA512: dba5c0217b915468af08475795437a10d8e8dedfadeb319f36d9b1bf54a91a8b2c61470a6047565855276c2bc8589c7776dc19237610b65b57cc841a303de8b3
2024-04-30 20:14:02 -04:00
Ava Chow
063072b86a
Merge bitcoin/bitcoin#29813: doc: i2p: improve -i2pacceptincoming mention
2179e2c320 doc: i2p: improve `-i2pacceptincoming` mention (brunoerg)

Pull request description:

  In i2p documentation, it says that "the first time Bitcoin Core connects to the I2P router,
  it automatically generates a persistent I2P address and its corresponding private key by
  default _**or if `-i2pacceptincoming=1` is set**_". This is weird, because `-i2pacceptincoming=1`
  by itself does not have any effect. Moreover, `-i2pacceptincoming` is 1 by default anyway.

ACKs for top commit:
  laanwj:
    This documentation change is correct and makes the documentation slightly shorter, thus easier to read. ACK 2179e2c320
  davidgumberg:
    ACK 2179e2c320
  achow101:
    ACK 2179e2c320
  byaye:
    ACK 2179e2c320

Tree-SHA512: 18a6a627343fb0aa824029d99df8a232153ba288ce94ec8c5da25693885237381fba505ea1e71c756b2a611243a302d319ca7ae03b526020cd6588710fc2ac17
2024-04-30 19:00:54 -04:00
Ava Chow
326e563360
Merge bitcoin/bitcoin#28016: p2p: gives seednode priority over dnsseed if both are provided
82f41d76f1 Added seednode prioritization message to help output (tdb3)
3120a4678a Gives seednode priority over dnsseed if both are provided (Sergi Delgado Segura)

Pull request description:

  This is a follow-up of #27577

  If both `seednode` and `dnsseed` are provided, the node will start a race between them in order to fetch data to feed the `addrman`.

  This PR gives priority to `seednode` over `dnsseed` so if some nodes are provided as seeds, they can be tried before defaulting to the `dnsseeds`

ACKs for top commit:
  davidgumberg:
    untested reACK 82f41d76f1
  itornaza:
    tested re-ACK 82f41d76f1
  achow101:
    ACK 82f41d76f1
  cbergqvist:
    ACK 82f41d76f1

Tree-SHA512: 4e39e10a7449af6cd9b8f9f6878f846b94bca11baf89ff2d4fbcd4f28293978a6ed71a3a86cea36d49eca891314c834e32af93f37a09c2cc698a878f84d31c62
2024-04-30 18:59:56 -04:00
Ava Chow
0c3a3c9394
Merge bitcoin/bitcoin#29623: Simplify network-adjusted time warning logic
c6be144c4b Remove timedata (stickies-v)
92e72b5d0d [net processing] Move IgnoresIncomingTxs to PeerManagerInfo (dergoegge)
7d9c3ec622 [net processing] Introduce PeerManagerInfo (dergoegge)
ee178dfcc1 Add TimeOffsets helper class (stickies-v)
55361a15d1 [net processing] Use std::chrono for type-safe time offsets (stickies-v)
038fd979ef [net processing] Move nTimeOffset to net_processing (dergoegge)

Pull request description:

  [An earlier approach](1d226ae1f9/) in #28956 involved simplifying and refactoring the network-adjusted time calculation logic, but this was eventually [left out](https://github.com/bitcoin/bitcoin/pull/28956#issuecomment-1904214370) of the PR to make it easier for reviewers to focus on consensus logic changes.

  Since network-adjusted time is now only used for warning/informational purposes, cleaning up the logic (building on @dergoegge's approach in #28956) should be quite straightforward and uncontroversial. The main changes are:

  - Previously, we would only calculate the time offset from the first 199 outbound peers that we connected to. This limitation is now removed, and we have a proper rolling calculation. I've reduced the set to 50 outbound peers, which seems plenty.
  - Previously, we would automatically use the network-adjusted time if the difference was < 70 mins, and warn the user if the difference was larger than that. Since there is no longer any automated time adjustment, I've changed the warning threshold to ~~20~~ 10 minutes (which is an arbitrary number).
  - Previously, a warning would only be raised once, and then never again until node restart. This behaviour is now updated to  1) warn to log for every new outbound peer for as long as we appear out of sync, 2) have the RPC warning toggled on/off whenever we go in/out of sync, and 3) have the GUI warn whenever we are out of sync (again), but limited to 1 messagebox per 60 minutes
  - no more globals
  - remove the `-maxtimeadjustment` startup arg

  Closes #4521

ACKs for top commit:
  sr-gi:
    Re-ACK [c6be144](c6be144c4b)
  achow101:
    reACK c6be144c4b
  dergoegge:
    utACK c6be144c4b

Tree-SHA512: 1063d639542e882186cdcea67d225ad1f97847f44253621a8c4b36c4d777e8f5cb0efe86bc279f01e819d33056ae4364c3300cc7400c087fb16c3f39b3e16b96
2024-04-30 18:49:34 -04:00
Ava Chow
d813ba1bc4
Merge bitcoin/bitcoin#28970: p2p: opportunistically accept 1-parent-1-child packages
e518a8bf8a [functional test] opportunistic 1p1c package submission (glozow)
87c5c524d6 [p2p] opportunistically accept 1-parent-1-child packages (glozow)
6c51e1d7d0 [p2p] add separate rejections cache for reconsiderable txns (glozow)
410ebd6efa [fuzz] break out parent functions and add GetChildrenFrom* coverage (glozow)
d095316c1c [unit test] TxOrphanage::GetChildrenFrom* (glozow)
2f51cd680f [txorphanage] add method to get all orphans spending a tx (glozow)
092c978a42 [txpackages] add canonical way to get hash of package (glozow)
c3c1e15831 [doc] restore comment about why we check if ptx HasWitness before caching rejected txid (glozow)
6f4da19cc3 guard against MempoolAcceptResult::m_replaced_transactions (glozow)

Pull request description:

  This enables 1p1c packages to propagate in the "happy case" (i.e. not reliable if there are adversaries) and contains a lot of package relay-related code. See https://github.com/bitcoin/bitcoin/issues/27463 for overall package relay tracking.

  Rationale: This is "non-robust 1-parent-1-child package relay" which is immediately useful.
  - Relaying 1-parent-1-child CPFP when mempool min feerate is high would be a subset of all package relay use cases, but a pretty significant improvement over what we have today, where such transactions don't propagate at all. [1]
  - Today, a miner can run this with a normal/small maxmempool to get revenue from 1p1c CPFP'd transactions without losing out on the ones with parents below mempool minimum feerate.
  - The majority of this code is useful for building more featureful/robust package relay e.g. see the code in #27742.

  The first 2 commits are followups from #29619:
  - https://github.com/bitcoin/bitcoin/pull/29619#discussion_r1523094034
  - https://github.com/bitcoin/bitcoin/pull/29619#discussion_r1519819257

  Q: What makes this short of a more full package relay feature?

  (1) it only supports packages in which 1 of the parents needs to be CPFP'd by the child. That includes 1-parent-1-child packages and situations in which the other parents already pay for themselves (and are thus in mempool already when the package is submitted). More general package relay is a future improvement that requires more engineering in mempool and validation - see #27463.

  (2) We rely on having kept the child in orphanage, and don't make any attempt to protect it while we wait to receive the parent. If we are experiencing a lot of orphanage churn (e.g. an adversary is purposefully sending us a lot of transactions with missing inputs), we will fail to submit packages. This limitation has been around for 12+ years, see #27742 which adds a token bucket scheme for protecting package-related orphans at a limited rate per peer.

  (3) Our orphan-handling logic is somewhat opportunistic; we don't make much effort to resolve an orphan beyond asking the child's sender for the parents. This means we may miss packages if the first sender fails to give us the parent (intentionally or unintentionally). To make this more robust, we need receiver-side logic to retry orphan resolution with multiple peers. This is also an existing problem which has a proposed solution in #28031.

  [1]: see this writeup and its links 02ec218c78/bip-0331.mediawiki (propagate-high-feerate-transactions)

ACKs for top commit:
  sr-gi:
    tACK e518a8bf8a
  instagibbs:
    reACK e518a8bf8a
  theStack:
    Code-review ACK e518a8bf8a 📦
  dergoegge:
    light Code review ACK e518a8bf8a
  achow101:
    ACK e518a8bf8a

Tree-SHA512: 632579fbe7160cb763bbec6d82ca0dab484d5dbbc7aea90c187c0b9833b8d7c1e5d13b8587379edd3a3b4a02a5a1809020369e9cd09a4ebaf729921f65c15943
2024-04-30 18:40:53 -04:00
Ava Chow
2d3056751b
Merge bitcoin/bitcoin#29906: Disable util::Result copying and assignment
6a8b2befea refactor: Avoid copying util::Result values (Ryan Ofsky)
834f65e824 refactor: Drop util::Result operator= (Ryan Ofsky)

Pull request description:

  This PR just contains the first two commits of #25665.

  It disables copying of `util::Result` objects because unnecessary copies are inefficient and not possible after #25665, which makes `util::Result` object move-only.

  It disables the assignment operator and replaces it with an `Update()` method, because #25665 adds more information to `util::Result` objects (warning and error messages and failure values) and having an assignment operator that overwrites data instead of merging it would make it easy to accidentally erase existing information while trying to assign new information.

ACKs for top commit:
  stickies-v:
    re-ACK 6a8b2befea
  achow101:
    ACK 6a8b2befea
  furszy:
    re-ACK 6a8b2befea

Tree-SHA512: 3f21af9031d50d6c68cca69133de03080f69b1ddcf8b140bdeb762069f14645209b2586037236d15b6ebd8973af0fbefd7e83144aeb7b84078a4cb4df812f984
2024-04-30 12:19:03 -04:00
glozow
15f696b454
Merge bitcoin/bitcoin#29986: test: Don't rely on incentive incompatible replacement in mempool_accept_v3.py
f8a141c2da test: Don't rely on incentive incompatible replacement in mempool_accept_v3.py (Suhas Daftuar)

Pull request description:

  In the sibling eviction test, we're currently testing that a transaction with ancestor feerate (and mining score) of 179 s/b is able to replace a transaction with ancestor feerate (and mining score) of 300 s/b, due to a shortcoming in our current RBF rules.

  In preparation for fixing our RBF rules to not allow such replacements, fix the test by bumping the fee of the replacement to be a bit higher.

ACKs for top commit:
  glozow:
    ACK f8a141c2da
  instagibbs:
    ACK f8a141c2da

Tree-SHA512: 0babe60be2f41634301e434fedb7abc765daaa37c2c280acb569eaf02a793369d81401ab02b8ae1689bda4872f475bd4c2f48cae4a54a61ece20db0a014e23ac
2024-04-30 10:01:00 +01:00
glozow
36e660fc23
Merge bitcoin/bitcoin#29990: fuzz: don't allow adding duplicate transactions to the mempool
cc15c5bfd1 fuzz: don't allow adding duplicate transactions to the mempool (Suhas Daftuar)

Pull request description:

  Filter duplicate transaction ids from being added to the mempool in the `partially_downloaded_block` fuzz target.

  I think a prerequisite for calling `CTxMemPool::addUnchecked` should be that the underlying txid doesn't already exist in the mempool (otherwise `addUnchecked` would need a way to return failure, which we don't currently have).

ACKs for top commit:
  glozow:
    utACK cc15c5bfd1 makes sense to me
  maflcko:
    lgtm ACK cc15c5bfd1
  brunoerg:
    ACK cc15c5bfd1
  dergoegge:
    utACK cc15c5bfd1

Tree-SHA512: 85f84ce405aba584e6d00391515f0a86c5648ce8b2da69036e50a6c1f6833d050d09b1972cc5ffbe7c4edb3e5f7f965ef34bd839deeddac27a889cc8d2e53b8f
2024-04-30 09:52:00 +01:00
merge-script
ad42d63519
Merge bitcoin/bitcoin#29985: depends: Fix build of Qt for 32-bit platforms with recent glibc
2e266f33b5 depends: Fix build of Qt for 32-bit platforms (laanwj)

Pull request description:

  The 32 to 64-bit `time_t` transition causes a build failure in the built-in zlib about conflicting `_TIME_BITS` and `_FILE_OFFSET_BITS`.

  Note that zlib doesn't use `time_t` at all, so it is a false alarm.

  Take the following patch from upstream zlib:
  a566e156b3.patch

  Closes #29980.

ACKs for top commit:
  hebasto:
    re-ACK 2e266f33b5.
  fanquake:
    ACK 2e266f33b5 - at some point qt's open source 5.15.x branch will catch up to where they bumped the internal zlib to >= 1.3 (which contains this change), and we'll be able to drop this patch. Checked that it fixes the build issue in the interim.

Tree-SHA512: b297aed8b299c671ff439b5b7b410832ff5004fd9b13c3b4a5fb5bde9dcf24a5eda08cd0a39565ae0641d9533711142bdc2889a32d343b9c4b41bfac24f0ca28
2024-04-30 14:19:35 +08:00
fanquake
5195baa600
depends: fix miniupnpc snprintf usage on Windows 2024-04-30 13:29:33 +08:00