Commit graph

39207 commits

Author SHA1 Message Date
dergoegge
24736350e9 [net processing] Don't process mutated blocks
We preemptively perform a block mutation check before further processing
a block message (similar to early sanity checks on other messsage
types). The main reasons for this change are as follows:

- `CBlock::GetHash()` is a foot-gun without a prior mutation check, as
  the hash returned only commits to the header but not to the actual
  transactions (`CBlock::vtx`) contained in the block.
- We have observed attacks that abused mutated blocks in the past, which
  could have been prevented by simply not processing mutated blocks
  (e.g. https://github.com/bitcoin/bitcoin/pull/27608).

Github-Pull: #29412
Rebased-From: 49257c0304
2024-03-05 10:24:17 +00:00
dergoegge
50c0b61a9d [validation] Merkle root malleation should be caught by IsBlockMutated
Github-Pull: #29412
Rebased-From: 2d8495e080
2024-03-05 10:24:16 +00:00
dergoegge
aff368fa81 [validation] Introduce IsBlockMutated
Github-Pull: #29412
Rebased-From: 66abce1d98
2024-03-05 10:21:16 +00:00
dergoegge
076c67c3aa [refactor] Cleanup merkle root checks
Github-Pull: #29412
Rebased-From: e7669e1343
2024-03-01 16:28:19 +00:00
dergoegge
97a1d0a459 [validation] Isolate merkle root checks
Github-Pull: #29412
Rebased-From: 95bddb930a
2024-03-01 16:27:43 +00:00
Hennadii Stepanov
4ac0eb543d test: Drop x modifier in fsbridge::fopen call for mingw builds
The MinGW-w64 toolchain links executables to the old msvcrt C Runtime
Library that does not support the `x` modifier for the _wfopen()
function.

Github-Pull: #29357
Rebased-From: d2fe90571e
2024-02-28 22:21:25 +00:00
glozow
a718bfafe7
Merge bitcoin/bitcoin#29503: 26.x: backport #28784 ("rpc: keep .cookie if it was not generated")
1e956439eb rpc: keep .cookie if it was not generated (Roman Zeyde)

Pull request description:

  v26 introduced a regression in that starting a `bitcoind` twice may have the second instance delete the cookie file of the first, making it impossible to communicate with it.

  Not a big deal but it's annoying, only an issue for 26.0, and the patch is trivial.

ACKs for top commit:
  glozow:
    lgtm ACK 1e956439eb

Tree-SHA512: 0e4b18aebaaf284944f1709b238c8c0acce5e8997409e0c278a5a30ac221ac1ff1d3ad31fbf2ac15b03bf7582891e07a7a2cf00f13cb596aa9512566b9320c23
2024-02-28 11:00:19 -05:00
Roman Zeyde
1e956439eb
rpc: keep .cookie if it was not generated
Otherwise, starting bitcoind twice may cause the `.cookie`
file generated by the first instance to be deleted by the
second instance shutdown (after failing to obtain a lock).

Github-Pull: bitcoin/bitcoin#28784
Rebased-From: 7cb9367157
2024-02-28 11:19:27 +01:00
fanquake
a4690485d1
Merge bitcoin/bitcoin#29440: [26.1] final changes for 26.1rc1
1e7fb270d3 [doc] add release notes for 26.1rc1 (glozow)
0ffeaf237a [doc] update manual pages for 26.1rc1 (glozow)
d4aeb4a5a0 [build] bump version to 26.1rc1 (glozow)
c27793891a qt: 26.1rc1 translations update (Hennadii Stepanov)
40e7693fa1 ci: Switch native macOS CI job to Xcode 15.0 (Hennadii Stepanov)
72eab1ca64 build: Fix `-Xclang -internal-isystem` option (Hennadii Stepanov)

Pull request description:

  Final changes to tag a 26.1rc1.
  Bumps version numbers, man pages, adds release notes etc.

ACKs for top commit:
  hebasto:
    re-ACK 1e7fb270d3
  fanquake:
    ACK 1e7fb270d3

Tree-SHA512: 0f4146590d61f4f9322f3147f672ff2af48fc1d85c708b959adcbdb50b8f280570cb732d9f4a424c014046d07e9aa6e408fc3a0337dbaf8cbaea5283697da35a
2024-02-19 15:31:06 +00:00
glozow
1e7fb270d3 [doc] add release notes for 26.1rc1 2024-02-16 17:30:26 +00:00
glozow
0ffeaf237a [doc] update manual pages for 26.1rc1 2024-02-16 17:29:46 +00:00
glozow
d4aeb4a5a0 [build] bump version to 26.1rc1 2024-02-16 17:29:46 +00:00
Hennadii Stepanov
c27793891a qt: 26.1rc1 translations update
This change is a result if pulling the recent translations
from the Transifex website using the
bitcoin-maintainer-tools/update-translations.py tool.

A few manual adjustments were made:
- skipped removing of `bitcoin_af.ts`
- skipped removing of `bitcoin_ar.ts`
- skipped adding of `bitcoin_ru_RU.ts` (`bitcoin_ru.ts` is already
present)
2024-02-16 17:29:46 +00:00
Hennadii Stepanov
40e7693fa1 ci: Switch native macOS CI job to Xcode 15.0
Github-Pull: #29195
Rebased-From: d742be3d3f
2024-02-16 17:29:31 +00:00
Hennadii Stepanov
72eab1ca64 build: Fix -Xclang -internal-isystem option
LLVM Clang >=16.0 and Apple Clang >=15.0 do not recognize
`-Xclang -internal-isystem/usr/local/include` anymore.

For example, see: cbbe1d4454

Github-Pull: #29195
Rebased-From: 8decc5c726
2024-02-16 17:28:33 +00:00
fanquake
74df372750
Merge bitcoin/bitcoin#29209: [26.x] more backports
11f3a7e6ba Use hardened runtime on macOS release builds. (Mark Friedenbach)
ac1b9a51db [test] import descriptor wallet with reorged parent + IsFromMe child in mempool (glozow)
ecb8ebc660 [test] rescan legacy wallet with reorged parent + IsFromMe child in mempool (Gloria Zhao)
438ac2947d snapshots: don't core dump when running -checkblockindex after `loadtxoutset` (Mark Friedenbach)
7ec34554af [log] mempool loading (glozow)
fe0f8fe8aa net: create I2P sessions with both ECIES-X25519 and ElGamal encryption (Jon Atack)
fc62271015 [refactor] Add helper for iterating through mempool entries (stickies-v)

Pull request description:

  Backports for 26.x. Includes:
  - 453b481 from #28391
    - #29179
  - #29200
  - #29227
  - #28791
  - #29127

ACKs for top commit:
  stickies-v:
    ACK 11f3a7e6ba

Tree-SHA512: 20ef871ec768f2328056d83f958e595b36ae9b8baa8a6e8b0e1f02c3df4b16965a8e05dcb4323afbcc9ecc4bdde10931232512022c39ee7e12baf9795bf25bf1
2024-02-16 13:37:21 +00:00
Mark Friedenbach
11f3a7e6ba
Use hardened runtime on macOS release builds.
The Apple notary service requires submitted app bundles to be configured to use the hardened runtime libraries.  This is configured at signing time, and supported by the signapple tool Bitcoin Core uses for reproduceable signed binaries.  We simply need to pass "--hardened-runtime" when the signature is created.  Once attached to the bundle, the resulting codesigned binary can be successfully submitted to the Apple binary notarization service by any Apple Developer.

Github-Pull: #29127
Rebased-From: 4fdd836db9
2024-01-19 16:14:36 +00:00
glozow
ac1b9a51db
[test] import descriptor wallet with reorged parent + IsFromMe child in mempool
Test that wallet rescans process transactions topologically, even if a
parent's entry into the mempool is later than that of its child.
This behavior is important because IsFromMe requires the ability to look
up a transaction's inputs.

Co-authored-by: furszy <matiasfurszyfer@protonmail.com>

Github-Pull: #29179
Rebased-From: df30247705
2024-01-19 16:13:22 +00:00
Gloria Zhao
ecb8ebc660
[test] rescan legacy wallet with reorged parent + IsFromMe child in mempool
Test that wallet rescans process transactions topologically, even if a
parent's entry into the mempool is later than that of its child.
This behavior is important because IsFromMe requires the ability to look
up a transaction's inputs.

Github-Pull: #29179
Rebased-From: c3d02be536
2024-01-19 16:13:14 +00:00
Mark Friedenbach
438ac2947d
snapshots: don't core dump when running -checkblockindex after loadtxoutset
Github-Pull: #28791
Rebased-From: cdc6ac4126
2024-01-19 16:13:05 +00:00
glozow
7ec34554af
[log] mempool loading
Log at the top before incrementing so that this log isn't printed when
there's only 1 tx.

Github-Pull: #29227
Rebased-From: eb78ea4eeb
2024-01-19 16:12:57 +00:00
Jon Atack
fe0f8fe8aa
net: create I2P sessions with both ECIES-X25519 and ElGamal encryption
A Bitcoin Core node may only connect to a peer destination via I2P if both sides
have sessions with the same encryption type.  The encryption type is a property
of the session, not the destination.  Sessions may support multiple encryption
types.

As Bitcoin Core is not currently setting the I2P encryption type when creating
sessions, it is using the older default, ElGamal (type 0).

This pull updates Bitcoin Core to use both ECIES-X25519 and ElGamal (types 4 and
0, respectively).  This allows to connect to I2P peers with either type, and the
newer, faster ECIES-X25519 will be preferred.

See also the recently updated section "Signature and Encryption Types" in
https://geti2p.net/en/docs/api/samv3

Thanks and credit to zzzi2p (https://github.com/zzzi2p) for reporting.

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

Github-Pull: #29200
Rebased-From: 9d728916b2
2024-01-19 16:12:47 +00:00
stickies-v
fc62271015
[refactor] Add helper for iterating through mempool entries
Instead of reaching into the mapTx data structure, use a helper method
that provides the required vector of CTxMemPoolEntry pointers.

Github-Pull: #28391
Rebased-From: 453b4813eb
2024-01-19 16:12:23 +00:00
glozow
04edf9f586
Merge bitcoin/bitcoin#29011: [26.x] Backports
7b79e54474 doc: update release notes for 26.x (fanquake)
ccf00b1e6e wallet: Fix use-after-free in WalletBatch::EraseRecords (MarcoFalke)
40252e184e ci: Set `HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK` to avoid failures (Hennadii Stepanov)
b06b14e68d rpc: getwalletinfo, return wallet 'birthtime' (furszy)
12834012c2 test: coverage for wallet birth time interaction with -reindex (furszy)
0fa47e2569 wallet: fix legacy spkm default birth time (furszy)
84f4a6c145 wallet: birth time update during tx scanning (furszy)
074296dd60 refactor: rename FirstKeyTimeChanged to MaybeUpdateBirthTime (furszy)
35039ac3cc fuzz: disable BnB when SFFO is enabled (furszy)
903b4623d3 test: add coverage for BnB-SFFO restriction (furszy)
05d0576d3c wallet: create tx, log resulting coin selection info (furszy)
5493ebbe74 wallet: skip BnB when SFFO is active (Murch)
b15e2e2cec test: add regression test for the getrawtransaction segfault (Martin Zumsande)
5097bb3389 rpc: fix getrawtransaction segfault (Martin Zumsande)
81e744a9a6 ci: Use Ubuntu 24.04 Noble for asan (MarcoFalke)
69e53d1e47 ci: Use Ubuntu 24.04 Noble for tsan,tidy,fuzz (MarcoFalke)
d2c80b6f52 doc: Missing additions to 26.0 release notes (fanquake)
8dc2c753ff doc: add historical release notes for 26.0 (fanquake)

Pull request description:

  Backports for `26.x`. Currently:
  * https://github.com/bitcoin/bitcoin/pull/28920
  * https://github.com/bitcoin/bitcoin/pull/28992
  * https://github.com/bitcoin/bitcoin/pull/28994
  * https://github.com/bitcoin/bitcoin/pull/29003
  * https://github.com/bitcoin/bitcoin/pull/29023
  * https://github.com/bitcoin/bitcoin/pull/29080
  * https://github.com/bitcoin/bitcoin/pull/29176

ACKs for top commit:
  TheCharlatan:
    ACK 7b79e54474
  glozow:
    ACK 7b79e54474, matches mine

Tree-SHA512: 898aec76ed3ad35e0edd0980af5bcc21bd60003bbf69e0b4f473ed2aa38c4e3b360b930bc3747cf798195906a8f9fe66417524f5e5ef40fa68f1c1aaceebdeb0
2024-01-09 15:39:19 +00:00
fanquake
7b79e54474
doc: update release notes for 26.x 2024-01-04 16:21:37 +00:00
MarcoFalke
ccf00b1e6e
wallet: Fix use-after-free in WalletBatch::EraseRecords
Github-Pull: #29176
Rebased-From: faebf1df2a
2024-01-04 16:21:37 +00:00
Hennadii Stepanov
40252e184e
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.

Github-Pull: #29080
Rebased-From: 43c3246af7
2024-01-04 16:21:37 +00:00
furszy
b06b14e68d
rpc: getwalletinfo, return wallet 'birthtime'
And add coverage for it

Github-Pull: #28920
Rebased-From: 1ce45baed7
2024-01-04 16:21:37 +00:00
furszy
12834012c2
test: coverage for wallet birth time interaction with -reindex
Verifying the wallet updates the birth time accordingly when it
detects a transaction with a time older than the oldest descriptor
timestamp.
This could happen when the user blindly imports a descriptor with
'timestamp=now'.

Github-Pull: #28920
Rebased-From: 83c66444d0
2024-01-04 16:21:37 +00:00
furszy
0fa47e2569
wallet: fix legacy spkm default birth time
To avoid scanning blocks, as assumed by a wallet with no
generated keys or imported scripts, the default value for
the birth time needs to be set to the maximum int64_t value.

Once the first key is generated or the first script is imported,
the legacy SPKM will update the birth time automatically.

Github-Pull: #28920
Rebased-From: 6f497377aa
2024-01-04 16:21:37 +00:00
furszy
84f4a6c145
wallet: birth time update during tx scanning
As the user could have imported a descriptor with
a newer timestamp (by blindly setting 'timestamp=now'),
the wallet needs to update the birth time when it detects
a transaction older than the oldest descriptor timestamp.

Github-Pull: #28920
Rebased-From: 75fbf444c1
2024-01-04 16:21:37 +00:00
furszy
074296dd60
refactor: rename FirstKeyTimeChanged to MaybeUpdateBirthTime
In the following-up commit, the wallet birth time will also
be modified by the transactions scanning process. When a tx
older than all descriptor's timestamp is detected.

Github-Pull: #28920
Rebased-From: b4306e3c8d
2024-01-04 16:21:37 +00:00
furszy
35039ac3cc
fuzz: disable BnB when SFFO is enabled
Github-Pull: #28994
Rebased-From: 576bee88fd
2024-01-04 16:21:36 +00:00
furszy
903b4623d3
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>

Github-Pull: #28994
Rebased-From: 05e5ff194c
2024-01-04 16:21:36 +00:00
furszy
05d0576d3c
wallet: create tx, log resulting coin selection info
Useful for understanding what is going on internally
when the software is running. Debug issues, and provide
more accurate feedback to users.

Github-Pull: #28994
Rebased-From: 0c5755761c
2024-01-04 16:21:36 +00:00
Murch
5493ebbe74
wallet: skip BnB when SFFO is active
Co-authored-by: furszy <matiasfurszyfer@protonmail.com>

Github-Pull: #28994
Rebased-From: 5cea25ba79
2024-01-04 16:21:36 +00:00
Martin Zumsande
b15e2e2cec
test: add regression test for the getrawtransaction segfault
This fails on master without the previous commit.

Github-Pull: #29003
Rebased-From: 9075a44646
2024-01-04 16:21:36 +00:00
Martin Zumsande
5097bb3389
rpc: fix getrawtransaction segfault
The crash would happen when querying a mempool transaction with verbosity=2, while pruning.

Github-Pull: #29003
Rebased-From: 494a926d05
2024-01-04 16:21:36 +00:00
MarcoFalke
81e744a9a6
ci: Use Ubuntu 24.04 Noble for asan
Github-Pull: #28992
Rebased-From: fad2392c58
2024-01-04 16:21:36 +00:00
MarcoFalke
69e53d1e47
ci: Use Ubuntu 24.04 Noble for tsan,tidy,fuzz
Github-Pull: #28992
Rebased-From: fa83b65ef8
2024-01-04 16:21:22 +00:00
fanquake
d2c80b6f52
doc: Missing additions to 26.0 release notes
Github-Pull: #29023
Rebased-From: ca5937553b
2023-12-08 09:18:28 +00:00
fanquake
8dc2c753ff
doc: add historical release notes for 26.0
Github-Pull: #29023
Rebased-From: 7d4e47d184
2023-12-08 09:18:24 +00:00
fanquake
44d8b13c81
Merge bitcoin/bitcoin#28959: [26.0] Finalize or rc4
b1d350c78b doc: update release notes for 26.0 (fanquake)
b0546bc907 doc: update manual pages for 26.0 (fanquake)
9ce1766d20 build: bump version to v26.0 final (fanquake)

Pull request description:

  Final changes for 26.0. Assuming no further backports. rc3 was done in #28872.

ACKs for top commit:
  achow101:
    ACK b1d350c78b
  hebasto:
    ACK b1d350c78b, I have reviewed the code and it looks OK.

Tree-SHA512: 8b1bfa9e9d6c5ccf8305335eba503c02a76043b2752e2302da84cb574078889ddb761b9efd14ef97f68bbae154b00ac54f531e2e33eba6baf8d703aa98ef5175
2023-12-04 10:45:21 +00:00
fanquake
b1d350c78b
doc: update release notes for 26.0 2023-11-28 16:13:36 +00:00
fanquake
b0546bc907
doc: update manual pages for 26.0 2023-11-28 16:12:43 +00:00
fanquake
9ce1766d20
build: bump version to v26.0 final 2023-11-28 16:09:47 +00:00
fanquake
e4fef4ae65
Merge bitcoin/bitcoin#28872: [26.x] Changes for rc3
2f86d30533 doc: update release notes for v26.0rc3 (fanquake)
3b6c7f240c doc: update manual pages for v26.0rc3 (fanquake)
3db4d1cff2 build: bump version to v26.0rc3 (fanquake)
6045f38dc8 build: Fix regression in "ARMv8 CRC32 intrinsics" test (Hennadii Stepanov)
5eaa179f27 ci: Avoid toolset ambiguity that MSVC can't handle (Hennadii Stepanov)
55af112565 p2p: do not make automatic outbound connections to addnode peers (Jon Atack)
5e0bcc1977 ci: Switch from `apt` to `apt-get` (Hennadii Stepanov)
437a5316e5 ci: Update apt cache (Hennadii Stepanov)
1488648104 pool: change memusage_test to use int64_t, add allocation check (Martin Leitner-Ankerl)
bcc183ccce pool: make sure PoolAllocator uses the correct alignment (Martin Leitner-Ankerl)
7dda4991a8 doc: regenerate example bitcoin.conf (fanquake)
5845331a6c doc: rewrite explanation for -par= (fanquake)

Pull request description:

  Currently backports:
  * https://github.com/bitcoin/bitcoin/pull/28858
  * https://github.com/bitcoin/bitcoin/pull/28895 (partial)
  * https://github.com/bitcoin/bitcoin/pull/28913
  * https://github.com/bitcoin/bitcoin/pull/28905
  * https://github.com/bitcoin/bitcoin/pull/28919
  * https://github.com/bitcoin/bitcoin/pull/28925

  Also includes changes for rc3, and reintegrating the release-notes.

ACKs for top commit:
  hebasto:
    re-ACK 2f86d30533, only https://github.com/bitcoin/bitcoin/pull/28919 backported since my [recent](https://github.com/bitcoin/bitcoin/pull/28872#pullrequestreview-1744950215) review.
  TheCharlatan:
    ACK 2f86d30533

Tree-SHA512: 43c91b344d37f582081ac184ac59cf76c741317b2b69a24fcd4287eefa8333e20c545e150798f4057d6f4ac8e70ed9cba1c8dd9777b11c1cf8992cce09108727
2023-11-22 18:25:34 +00:00
fanquake
2f86d30533
doc: update release notes for v26.0rc3
Few further changes are expected, so reintegrate the release-notes.
2023-11-22 17:22:06 +00:00
fanquake
3b6c7f240c
doc: update manual pages for v26.0rc3 2023-11-22 17:22:06 +00:00
fanquake
3db4d1cff2
build: bump version to v26.0rc3 2023-11-22 17:22:06 +00:00