Commit Graph

42637 Commits

Author SHA1 Message Date
Hennadii Stepanov
5b368f88a9 depends: Fix CXXFLAGS on NetBSD
This change corrects an issue where CXXFLAGS were mistakenly overridden
by CFLAGS.

Github-Pull: 31502
Rebased-From: a10bb400e8
2025-01-02 14:18:28 +01:00
MarcoFalke
05cd448e33 test: generateblocks called by multiple threads
Co-Authored-By: David Gumberg <davidzgumberg@gmail.com>

Github-Pull: 31563
Rebased-From: fa63b8232f
2025-01-02 14:17:02 +01:00
MarcoFalke
621c634b7f rpc: Extend scope of validation mutex in generateblock
The mutex (required by TestBlockValidity) must be held after creating
the block, until TestBlockValidity is called. Otherwise, it is possible
that the chain advances in the meantime and leads to a crash in
TestBlockValidity:

 Assertion failed: pindexPrev && pindexPrev == chainstate.m_chain.Tip() (validation.cpp: TestBlockValidity: 4338)

The diff can be reviewed with the git options
--ignore-all-space --function-context

Github-Pull: 31563
Rebased-From: fa62c8b1f0
2025-01-02 14:16:50 +01:00
Ava Chow
6db725662d
Merge bitcoin/bitcoin#31469: [28.x] 28.1rc2 backports
5576618152 doc: update release notes for 28.1rc2 (Ava Chow)
01fe07a2ce examples: Generate example bitcoin.conf (Ava Chow)
7ddfcf32da doc: Generate manpages (Ava Chow)
e0b27b234c build: Bump to 28.1rc2 (Ava Chow)
bdc6b3e531 Add release note for #31223 (Martin Zumsande)
a0585b6087 test: add functional test for -port behavior (Martin Zumsande)
bbde830b97 net, init: derive default onion port if a user specified a -port (Martin Zumsande)
227642d5af test: fix MIN macro-redefinition (0xb10c)
b8112cf422 util: use explicit cast in MultiIntBitSet::Fill() (Vasil Dimov)
2835158be0 fuzz: add cstdlib to FuzzedDataProvider (fanquake)

Pull request description:

  Backports:

  * #31223
  * #31448
  * #31431
  * #31419

ACKs for top commit:
  hodlinator:
    re-ACK 5576618152

Tree-SHA512: f99f3c5960f18f6894832c5f9a827f97fd3c6e086670341760ce1b77c304d53136492371c59148f3b4bbcfe2d5428c835fe632c61b229b40f1f6f6cf2b72cdca
2024-12-17 13:06:08 -05:00
Ava Chow
5576618152 doc: update release notes for 28.1rc2 2024-12-13 21:27:57 -05:00
Ava Chow
01fe07a2ce examples: Generate example bitcoin.conf 2024-12-13 21:20:23 -05:00
Ava Chow
7ddfcf32da doc: Generate manpages 2024-12-13 21:19:41 -05:00
Ava Chow
e0b27b234c build: Bump to 28.1rc2 2024-12-13 21:16:24 -05:00
Martin Zumsande
bdc6b3e531
Add release note for #31223
Co-authored-by: Vasil Dimov <vd@FreeBSD.org>

Github-Pull: bitcoin/bitcoin#31223
Rebased-From: 1dd3af8fbc
2024-12-13 21:15:29 -05:00
Martin Zumsande
a0585b6087
test: add functional test for -port behavior
Github-Pull: bitcoin/bitcoin#31223
Rebased-From: 997757dd2b
2024-12-13 21:15:26 -05:00
Martin Zumsande
bbde830b97
net, init: derive default onion port if a user specified a -port
After port collisions are no longer tolerated but lead to
a startup failure in v28.0, local setups of multiple nodes,
each with a different -port value would not be possible anymore
due to collision of the onion default port - even if the nodes
were using tor or not interested in receiving onion inbound connections.

Fix this by deriving the onion listening port to be -port + 1.
(idea by vasild / laanwj)

Co-authored-by: Vasil Dimov <vd@FreeBSD.org>

Github-Pull: bitcoin/bitcoin#31223
Rebased-From: 0e2b12b92a
2024-12-13 21:15:23 -05:00
0xb10c
227642d5af
test: fix MIN macro-redefinition
Renames the `MIN` macro to `_TRACEPOINT_TEST_MIN`.

From #31418:

```
stderr:
/virtual/main.c:70:9: warning: 'MIN' macro redefined [-Wmacro-redefined]
   70 | #define MIN(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
      |         ^
include/linux/minmax.h:329:9: note: previous definition is here
  329 | #define MIN(a,b) __cmp(min,a,b)
      |         ^
1 warning generated.
```

fixes: https://github.com/bitcoin/bitcoin/issues/31418

Github-Pull: bitcoin/bitcoin#31419
Rebased-From: 00c1dbd26d
2024-12-11 11:41:49 -05:00
Vasil Dimov
b8112cf422
util: use explicit cast in MultiIntBitSet::Fill()
The current code does not have a bug, but is implicitly casting -1 to
65535 and the sanitizer has no way to know whether we intend that or
not.

```
FUZZ=bitset src/test/fuzz/fuzz /tmp/fuz

error: implicit conversion from type 'int' of value -1 (32-bit, signed)
to type 'value_type' (aka 'unsigned short') changed the value to 65535
(16-bit, unsigned)

Base64: Qv7bX/8=
```

Github-Pull: bitcoin/bitcoin#31431
Rebased-From: edb41e4814
2024-12-11 11:41:39 -05:00
fanquake
2835158be0
fuzz: add cstdlib to FuzzedDataProvider
Same as https://github.com/llvm/llvm-project/pull/113951.

Avoids compile failures under clang-20 &
`D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES`:
```bash
In file included from /bitcoin/src/test/fuzz/addition_overflow.cpp:5:
/bitcoin/src/test/fuzz/FuzzedDataProvider.h:209:5: error: use of undeclared identifier 'abort'
  209 |     abort();
      |     ^
/bitcoin/src/test/fuzz/FuzzedDataProvider.h:250:5: error: use of undeclared identifier 'abort'
  250 |     abort();
```

Github-Pull: bitcoin/bitcoin#31448
Rebased-From: bb7e686341
2024-12-11 11:41:27 -05:00
Luke Dashjr
b0aab7bacf Drop default dbfilesize to 64 MiB
Actual benchmarks suggest 64 MiB performs better than 128 MiB
2024-12-05 22:05:14 +00:00
Anthony Towns
9e4dad615d p2p: Increase tx relay rate
In the presence of smaller transactions on the network, blocks can sustain a
higher relay rate than 7tx/second. In this event, the per-peer inventory queues
can grow too large.

This commit bumps the rate up to 14 tx/s (for inbound peers), increasing the
safety margin by a factor of 2.

Outbound peers continue to receive relayed transactions at 2.5x the rate of
inbound peers, for a rate of 35tx/second.

Co-Authored-By: Suhas Daftuar <sdaftuar@gmail.com>

Github-Pull: #28592
Rebased-From: b81f37031c8f2ccad9346f1b65ee0f8083c44796
2024-12-05 20:40:31 +00:00
merge-script
d6b225f165
Merge bitcoin/bitcoin#31104: [28.x] Backports & 28.1rc1
8fef83a0a0 doc: update manual pages for 28.1rc1 (fanquake)
df7764621e build: bump version to 28.1rc1 (fanquake)
9add853b65 doc: update release notes for 28.1rc1 (fanquake)
1025090fbe build: disable compiling fuzz/utxo_snapshot.cpp with MSVC (fanquake)
446f5d20d6 refactor: Drop deprecated space in operator""_mst (MarcoFalke)
9976162a0e addrman: change nid_type from int to int64_t (Martin Zumsande)
1d0411dc8f addrman, refactor: introduce user-defined type for internal nId (Martin Zumsande)
7fec638222 depends: For mingw cross compile use -gcc-posix to prevent library conflict (laanwj)
f998ac6286 key: clear out secret data in `DecodeExtKey` (Sebastian Falbesoner)
0773560abf ci: add LLVM_SYMBOLIZER_PATH to Valgrind fuzz job (fanquake)
b917334208 test: add missing sync to feature_fee_estimation.py (Martin Zumsande)
f072721181 doc: add testnet4 section header for config file (Marnix)
6643fd2145 doc: Archive 28.0 release notes (Ava Chow)

Pull request description:

  Backports:
  * #30568
  * #31007
  * #31013
  * #31016
  * #31035
  * #31166

  Contains:
  * A commit to do the same as #31307.

ACKs for top commit:
  willcl-ark:
    ACK 8fef83a0a0

Tree-SHA512: 58f0c6cb9e5b7ac17ad20141acdc5423dbe8e79cc3a2cf1c4e503d289b75940632c9838c64e3ac733b1a55e65723fc1071ccdd9a860a710256cc88e29f42ccdb
2024-12-04 13:36:28 +00:00
fanquake
8fef83a0a0
doc: update manual pages for 28.1rc1 2024-12-02 14:20:15 +00:00
fanquake
df7764621e
build: bump version to 28.1rc1 2024-12-02 14:20:15 +00:00
fanquake
9add853b65
doc: update release notes for 28.1rc1 2024-12-02 14:20:15 +00:00
fanquake
1025090fbe
build: disable compiling fuzz/utxo_snapshot.cpp with MSVC
This is a backport of #31307 / b2d5361002
for 28.x.
2024-12-02 14:20:15 +00:00
MarcoFalke
446f5d20d6
refactor: Drop deprecated space in operator""_mst
Github-Pull: #31267
Rebased-From: faf2162565
2024-12-02 14:20:14 +00:00
Martin Zumsande
9976162a0e
addrman: change nid_type from int to int64_t
With nId being incremented for each addr received,
an attacker could cause an overflow in the past.
(https://bitcoincore.org/en/2024/07/31/disclose-addrman-int-overflow/)
Even though that attack was made infeasible by
rate-limiting (PR #22387), to be on the safe side change the
type to an int64_t.

Github-Pull: #30568
Rebased-From: 51f7668d31
2024-12-02 14:19:59 +00:00
Luke Dashjr
d4b5aa0f04 doc: RPC/Wallet: Attempt to explain the dummy parameter 2024-11-14 18:30:13 +00:00
Luke Dashjr
be412ac6bc RPC/Wallet: getbalance: Throw an error if avoid_reuse is set but ignored 2024-11-14 18:30:13 +00:00
Luke Dashjr
93446f937a RPC/Wallet: getbalance: Avoid calling modern GetBalance when its result is unused 2024-11-14 18:30:13 +00:00
Luke Dashjr
cf5ec99cb0 Bugfix: Wallet: Use CHECK_NONFATAL for findBlock in GetLegacyBalance 2024-11-14 18:30:13 +00:00
Luke Dashjr
d09a74c7e4 RPC/Wallet: Hacky fix for getbalance bugs 2024-11-14 18:30:13 +00:00
Luke Dashjr
0c7ac92072 RPC: Support first param name in GetParamIndex (and Arg<T>)
Prior to this change, if any parameter had multiple names, the RPC call would fail
2024-11-14 02:00:01 +00:00
ismaelsadeeq
5dcab5edf5 rpc: reserve space for UniValue variables in blockToJSON
- Reserving space avoid reallocation, this provide noticeable
  performance increase in verbosity level 1, 2.

Github-Pull: #31179
Rebased-From: 28e3392d11355b1160dc1a7a5557081728a02840
2024-11-10 20:24:29 +00:00
ismaelsadeeq
1c894b355e UniValue: add reserve member function
- Only reserve keys when the typ is of `VOBJ`.

Github-Pull: #31179
Rebased-From: 952463ccdc2baeacb527c66732fd184cbcbd53ba
2024-11-10 20:24:29 +00:00
pablomartin4btc
5e1c728cf1 gui: Fix proxy details display in Options Dialog
- Ensured that the proxy IP is displayed correctly in the UI when using an IPv6 address.

No functionality impact; changes only affect UI display.

Github-Pull: gui#836
Rebased-From: fee4cba484
2024-11-10 19:56:34 +00:00
Evan Klitzke
2bc60a4acb Try to use posix_fadvise with CBufferedFile
This primarily affects blocks when bitcoin is launched with -reindex, as
that causes the block files to be loaded as CBufferedFile objects one at
a time as the reindex progresses.

Co-Authored-By: Luke Dashjr <luke-jr+git@utopios.org>

Github-Pull: #14485
Rebased-From: 289e88b3133107f8a54184d8316559c7cf8ddb12
2024-11-10 19:13:17 +00:00
Luke Dashjr
1ad1438d91 Merge branch 'bufferedfile_fclose' into fadvise-28+knots 2024-11-10 19:12:29 +00:00
Luke Dashjr
b8a4937e52 util: Disable RandAddSeedPerfmon
RegQueryValueExA(HKEY_PERFORMANCE_DATA, ...) sometimes hangs bitcoind.exe on Windows during startup, at least on CI.

We have other sources of entropy to seed randomness with on Windows, so should be alright removing this. Might resurrect if less drastic fix is found.

Github-Pull: #31124
Based-on: 9bb92c0e7f
2024-11-10 18:21:47 +00:00
Antoine Poinsot
6c24ce7025 [test] A non-standard transaction which is also consensus-invalid should return the consensus error
Github-Pull: #31097
Rebased-From: 86e2a6b749
2024-11-10 17:58:12 +00:00
dergoegge
2d69e4c454 [validation] Improve script check error reporting
Github-Pull: #31097
Rebased-From: f859ff8a4e
2024-11-10 17:58:12 +00:00
TheCharlatan
e37bae9d03 init: Correct coins db cache size setting
The chainstate caches are currently re-balanced on startup
even in the non-assumeutxo case, leading to the database being
needlessly re-opened and its cache re-allocated.

Similar to `InitCoinsCache` and `m_coinstip_cache_size_bytes` the
`m_coinsdb_cache_size_bytes` should be set in `InitCoinsDB`.

Together with only conservatively setting the cache values when a
assumeutxo chainstate is present, this allows for skipping the cache
re-balance during initialization in the normal non-assumeutxo case.

Github-Pull: #31064
Rebased-From: 3a4a788ee0
2024-11-09 23:19:02 +00:00
Fabian Jahr
d7b38dd312 contrib: Update asmap link in seeds readme
Github-Pull: #30979
Rebased-From: f158993fd5
2024-11-09 22:25:04 +00:00
MarcoFalke
d8cb709033 log: Enforce trailing newline
Github-Pull: #30929
Rebased-From: bbbb2e43ee (partial)
2024-11-09 21:54:44 +00:00
Fabian Jahr
8253fe7d1a validation: Don't assume m_chain_tx_count in GuessVerificationProgress
In the context of an a descriptor import during assumeutxo background sync, the progress can not be estimated due to m_chain_tx_count being set to 0.

Github-Pull: #30909
Rebased-From: 8e1efa10df1d9edbe766cbdbdfcd7e262b4f2464 (diff-minimised)
2024-11-09 21:40:25 +00:00
Luke Dashjr
5302aa8ca6 Diff-minimise 2024-11-09 19:19:12 +00:00
Vasil Dimov
06105d8da8 util: explicitly close all AutoFiles that have been written
There is no way to report a close error from `AutoFile` destructor.
Such an error could be serious if the file has been written to because
it may mean the file is now corrupted (same as if write fails).

So, change all users of `AutoFile` that use it to write data to
explicitly close the file and handle a possible error.

Github-Pull: #29307
Rebased-From: dba783538683cfc6af209c640c2d019648493f31
2024-11-09 19:18:20 +00:00
Martin Zumsande
1d0411dc8f
addrman, refactor: introduce user-defined type for internal nId
This makes it easier to track which spots refer to an nId
(as opposed to, for example, bucket index etc. which also use int)

Co-authored-by: Pieter Wuille <pieter@wuille.net>

Github-Pull: #30568
Rebased-From: 051ba3290e
2024-11-04 16:27:06 +00:00
laanwj
7fec638222
depends: For mingw cross compile use -gcc-posix to prevent library conflict
CMake parses some paths from the spec of the C compiler, assuming it
will be the linker, resulting in the link to end up with
`-L/usr/lib/gcc/x86_64-w64-mingw32/12-win32` on debian bookworm if both
-win32 and -posix variants are installed, and -win32 is the default
alternative.

This results in the wrong C++ library being linked, missing
std::threads::hardware_concurrency and other threading functions.

To fix this, use the -posix variant of gcc as well when available. This
fixes a regression compared to autotools, where this scenario worked.

Github-Pull: #31013
Rebased-From: ae56b3230b
2024-10-31 15:07:51 +00:00
Sebastian Falbesoner
f998ac6286
key: clear out secret data in DecodeExtKey
Same as in `DecodeSecret`, we should also clear out the secret data from
the vector resulting from the Base58Check parsing for xprv keys. Note
that the if condition is needed in order to avoid UB, see #14242 (commit
d855e4cac8).

Github-Pull: #31166
Rebased-From: 559a8dd9c0
2024-10-31 14:48:56 +00:00
Hennadii Stepanov
c3c6c5a2c4 subprocess: Fix cross-compiling for Windows
Github-Pull: #29868
Rebased-From: 2f939519f1d96bc54319e2b8d18e475cbf3cd008
2024-10-30 21:10:19 +00:00
fanquake
0773560abf
ci: add LLVM_SYMBOLIZER_PATH to Valgrind fuzz job
Otherwise:
```bash
	NEW_FUNC[1/23]: ==4710==WARNING: invalid path to external symbolizer!
==4710==WARNING: Failed to use and restart external symbolizer!
0xb72010  (/ci_container_base/ci/scratch/build-x86_64-pc-linux-gnu/src/test/fuzz/fuzz+0xa6a010) (BuildId: 2087ad415cb752eea259ed750f3b78a7fcb0b43b)
	NEW_FUNC[2/23]: 0xb72240  (/ci_container_base/ci/scratch/build-x86_64-pc-linux-gnu/src/test/fuzz/fuzz+0xa6a240) (BuildId: 2087ad415cb752eea259ed750f3b78a7fcb0b43b)

```

Github-Pull: #30961
Rebased-From: c1832584bf
2024-10-22 16:06:06 +01:00
Martin Zumsande
b917334208
test: add missing sync to feature_fee_estimation.py
Fixes a race between node 1 catching up with the chain and mining a
new block in the sanity_check_rbf_estimates subtest.

Github-Pull: #31016
Rebased-From: a1576edab3
2024-10-22 16:04:14 +01:00
Marnix
f072721181
doc: add testnet4 section header for config file
Github-Pull: #31007
Rebased-From: 61cdb1c9d8
2024-10-22 16:04:04 +01:00