Commit Graph

45275 Commits

Author SHA1 Message Date
Sebastian Falbesoner
4ef6253017 test: avoid unneeded (w)txid hex -> integer conversions
Rather than determining a CTransaction's (w)txid as an integer by
converting it's hex value, it can be directly accessed via the
introduced `.{w,}txid_int` property.
2025-06-11 00:52:25 +02:00
Sebastian Falbesoner
472f3770ae scripted-diff: test: rename CTransaction .getwtxid() -> wtxid_hex for consistency
-BEGIN VERIFY SCRIPT-

sed -i "s|def getwtxid|@property\n    def wtxid_hex|g" ./test/functional/test_framework/messages.py
sed -i "s|getwtxid()|wtxid_hex|g" $(git grep -l getwtxid)

-END VERIFY SCRIPT-
2025-06-11 00:52:25 +02:00
Sebastian Falbesoner
81af4334e8 test: rename CTransaction .sha256 -> .txid_int for consistency
Note that we unfortunately can't use a scripted diff here, as the same
property name is also used for `CBlockHeader`/`CBlock` instances.
2025-06-11 00:52:25 +02:00
Sebastian Falbesoner
ce83924237 test: rename CTransaction .rehash()/.hash -> .txid_hex for consistency
Note that we unfortunately can't use a scripted diff here, as the same
property and method name is also used for `CBlockHeader`/`CBlock` instances.
2025-06-11 00:49:10 +02:00
Ava Chow
c3fe85e2d6 wallet, rpc, test: Remove deprecated getunconfirmedbalance 2025-06-10 15:07:11 -07:00
Ava Chow
0ec255139b wallet, rpc: Remove deprecated balances from getwalletinfo 2025-06-10 14:49:02 -07:00
merge-script
157bbd0a07 Merge bitcoin/bitcoin#32425: config: allow setting -proxy per network
e98c51fcce doc: update tor.md to mention the new -proxy=addr:port=tor (Vasil Dimov)
ca5781e23a config: allow setting -proxy per network (Vasil Dimov)

Pull request description:

  `-proxy=addr:port` specifies the proxy for all networks (except I2P). Previously only the Tor proxy could have been specified separately via `-onion=addr:port`.

  Make it possible to specify separately the proxy for IPv4, IPv6, Tor and CJDNS by e.g. `-proxy=addr:port=ipv6`. Or remove the proxy for a given network, e.g. `-proxy=0=cjdns`.

  Resolves: https://github.com/bitcoin/bitcoin/issues/24450

ACKs for top commit:
  pinheadmz:
    ACK e98c51fcce
  caesrcd:
    reACK e98c51fcce
  danielabrozzoni:
    Code Review ACK e98c51fcce
  1440000bytes:
    ACK e98c51fcce

Tree-SHA512: 0cb590cb72b9393cc36357e8bd7861514ec4c5bc044a154e59601420b1fd6240f336ab538ed138bc769fca3d17e03725d56de382666420dc0787895d5bfec131
2025-06-10 15:57:09 -04:00
merge-script
ebec7bf389 Merge bitcoin/bitcoin#32572: doc: Remove stale sections in dev notes
fac00d4ed3 doc: Move CI-must-pass requirement into readme section (MarcoFalke)
fab79c1a25 doc: Clarify and move "hygienic commit" note (MarcoFalke)
fac8b05197 doc: Clarify strprintf size specifier note (MarcoFalke)
faaf34ad72 doc: Remove section about RPC alias via function pointer (MarcoFalke)
2222d61e1c doc: Remove section about RPC arg names in table (MarcoFalke)
fa00b8c02c doc: Remove section about include guards (MarcoFalke)
fad6cd739b doc: Remove dev note section on includes (MarcoFalke)
fa6623d85a doc: Remove file name section (MarcoFalke)
7777fb8bc7 doc: Remove shebang section (MarcoFalke)
faf65f0531 doc: Remove .gitignore section (MarcoFalke)
faf2094f25 doc: Remove note about removed ParsePrechecks (MarcoFalke)
fa69c5b170 doc: Remove -disablewallet from dev notes (MarcoFalke)

Pull request description:

  This removes sections that I've been collecting as stale or overly redundant over the years. The rationale for each removal is in the commit message.

ACKs for top commit:
  yuvicc:
    ACK fac00d4ed3
  janb84:
    LGTM ACK fac00d4ed3
  glozow:
    ACK fac00d4ed3, all lgtm

Tree-SHA512: 17a5b4277fb30d265959d1230a705b36d8501a64c0f4a7f272ea5d9c22031421f95c491144f6d6f714dc7927df667d96ece9ceb43e0a07317d76fdcc4769aaa7
2025-06-10 15:41:11 -04:00
pablomartin4btc
ce90f0c99f rpc, wallet, refactor: Remove non-descriptor errors
It is not possible to load a legacy/ non-descriptor wallet anymore
so no need to check for WALLET_FLAG_DESCRIPTORS in RPC calls, even when
passing -rpcwallet/ JSON `/wallet/<walletname>/` endpoint, that searches
for the wallets loaded already in the context.
2025-06-10 16:34:17 -03:00
pablomartin4btc
573bcd75d7 wallet, refactor: Remove unused SetupGeneration
SetupGeneration was supposed to be the function that all SPKMs used
to setup automatic generation, but it didn't work out that way and
ended up being legacy only. It should be deleted at this point.
2025-06-10 16:34:17 -03:00
pablomartin4btc
5431f2dc21 wallet, refactor: Remove Legacy warnings and errors
Remove dead code due to legacy wallet removal.
2025-06-10 16:27:42 -03:00
Ryan Ofsky
6f1392cc42 indexes, refactor: Remove remaining CBlockIndex* uses in index Rewind methods
Move ReadBlock code from CoinStatsIndex::CustomRewind to BaseIndex::Rewind

Move ReadUndo code from CoinStatsIndex::ReverseBlock to BaseIndex::Rewind

This commit does change behavior slightly. Since the new CustomRemove
methods only take a single block at a time instead of a range of
disconnected blocks, when they call CopyHeightIndexToHashIndex they will
now do an index seek for each removed block instead of only seeking once
to the height of the earliest removed block. Seeking instead of scanning
is a little worse for performance if there is a >1 block reorg, but
probably not noticeable unless the reorg is very deep.
2025-06-10 12:57:15 -04:00
Ryan Ofsky
0a248708dc indexes, refactor: Stop requiring CBlockIndex type to call IsBIP30Unspendable
This commit does not change behavior in any way.
2025-06-10 12:57:15 -04:00
merge-script
011a8c5f01 Merge bitcoin/bitcoin#32696: doc: make -DWITH_ZMQ=ON explicit on build-unix.md
32d4e92b9a doc: make `-DWITH_ZMQ=ON` explicit on `build-unix.md` (Luis Schwab)

Pull request description:

  ZMQ support is not built by default on Linux, and the docs don't make that clear. This PR makes it explicit that the `-DWITH_ZMQ=ON` flag is required to build with ZMQ support on `build-unix.md`.

ACKs for top commit:
  maflcko:
    lgtm ACK 32d4e92b9a

Tree-SHA512: 322d0dd86bb80aa5a5640a5510cbeeec29f490c33b8f7360e3a202147a02c303064e6761ceb42e38e26982c61f35c9b048804c705a0d95c5737ebd2109febead
2025-06-10 17:26:04 +01:00
merge-script
fe39050a66 Merge bitcoin/bitcoin#32678: guix: warn and abort when SOURCE_DATE_EPOCH is set
5c4a0f8009 guix: warn and abort when SOURCE_DATE_EPOCH is set (will)

Pull request description:

  Fixes: #29935

  Current behaviour will by-default use SOURCE_DATE_EPOCH from the environment without warning. This breaks the default reproducibility from a guix build.

  Warn when and exit when this variable is set, and
  FORCE_SOURCE_DATE_EPOCH is unset.

ACKs for top commit:
  maflcko:
    lgtm ACK 5c4a0f8009
  fanquake:
    ACK 5c4a0f8009

Tree-SHA512: fdd6095a91bd87ffdc22918dc43869edc2380501d1b047e95caadd8a6624928691bfe5b7af9693177cbc28e69366e3397e43a06f2f346cc3a9fe233b7fb9588f
2025-06-10 15:22:03 +01:00
merge-script
692fe280c2 Merge bitcoin/bitcoin#32713: doc: fuzz: fix AFL++ link
a39b7071cf doc: fuzz: fix AFL++ link (brunoerg)

Pull request description:

  Fix link about selecting the best AFL compiler.

ACKs for top commit:
  maflcko:
    lgtm ACK a39b7071cf

Tree-SHA512: 6366f18767f6c60f806faa374bd4a6a3bb71a1c74b7040867177ca9ded946707a75b4f39bf698530ba9c5ff708394d88f5b29f4a92f9e95aaca7b37c62b72093
2025-06-10 15:18:32 +01:00
Hodlinator
239fc4d62e doc, windows: CompanyName "Bitcoin" => "Bitcoin Core project"
Matches /share/setup.nsi.in:14
2025-06-10 15:14:24 +02:00
merge-script
c1d4253d31 Merge bitcoin/bitcoin#32711: doc: add missing packages for BSDs (cmake, gmake, curl) to depends/README.md
89526deddf doc: add missing packages for BSDs (cmake, gmake, curl) to depends/README.md (Sebastian Falbesoner)

Pull request description:

  Suggested initially only for OpenBSD and cmake (see https://github.com/bitcoin/bitcoin/pull/32690#issuecomment-2949660658, https://github.com/bitcoin/bitcoin/pull/32690#issuecomment-2949729126), this PR adds missing package recommendations for other BSDs as well in order to build depends. I tested this only on OpenBSD, but found the package names for the other BSDs on the ports search engines:
  * FreeBSD: https://ports.freebsd.org/cgi/ports.cgi
  * NetBSD: https://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/index-all.html

  At least on OpenBSD, curl is a [dependency of git](879e73073b/devel/git/Makefile (L49-L50)), so most users will not need to install it explicitly. But as git is not the only way to obtain the source code, I think it doesn't hurt to list it, and we also do it already for Ubuntu & Debian:
  f3bbc74664/depends/README.md (L9-L11)

ACKs for top commit:
  maflcko:
    lgtm ACK 89526deddf
  Sjors:
    re-utACK 89526deddf
  hebasto:
    ACK 89526deddf.

Tree-SHA512: ba8b540f902b924740c81c5d874f9525d214b75c5892cd1234db2207e9ca96c2bc80e8b743e0d924a55f40a91894cbb4a6635f1561998a7e0ba26d9f68e0e1a4
2025-06-10 13:28:27 +01:00
Sebastian Falbesoner
89526deddf doc: add missing packages for BSDs (cmake, gmake, curl) to depends/README.md 2025-06-10 13:04:25 +02:00
brunoerg
a39b7071cf doc: fuzz: fix AFL++ link
Co-authored-by: eugene <elzeigel@gmail.com>
2025-06-09 18:51:17 -03:00
Ava Chow
dff208bd5a Merge bitcoin/bitcoin#32708: rpc, doc: update listdescriptors RCP help
b44514b876 rpc, doc: update `listdescriptors` RCP help (rkrux)

Pull request description:

  This RPC lists all the descriptors present in the wallet, not only the ones that were imported, but also the ones generated when a new wallet is created.

  It can be verified by creating a new wallet and calling the `listdescriptors` RPC, which will contain 8 ranged descriptors that are created for every new wallet.

  Also, update the description to get rid of "descriptor-enabled" because this is the only wallet type available now after removal of legacy wallets.

ACKs for top commit:
  maflcko:
    lgtm ACK b44514b876
  achow101:
    ACK b44514b876
  pablomartin4btc:
    ACK b44514b876
  theStack:
    ACK b44514b876

Tree-SHA512: d1018dd42fc4de12793f3e4f3be79ecb3fdee46fbc93ec8adb62b29a86e74aba2605d9908632107061f48ef8ee6f39ef6d0e34cc5e91acd93bc02242a2cee3eb
2025-06-09 14:38:14 -07:00
Ava Chow
d978a43d05 Merge bitcoin/bitcoin#32408: tests: Expand HTTP coverage to assert libevent behavior
f16c8c67bf tests: Expand HTTP coverage to assert libevent behavior (Matthew Zipkin)

Pull request description:

  These commits are cherry-picked from #32061  and part of a project to [remove libevent](https://github.com/bitcoin/bitcoin/issues/31194).

  This PR only adds functional tests to `interface_http` to cover some HTTP server behaviors we inherit from libevent, in order to maintain those behaviors when we replace libevent with our own HTTP server.

  1. Pipelining: The server must respond to requests from a client in the order in which they were received [RFC 7230 6.3.2](https://www.rfc-editor.org/rfc/rfc7230#section-6.3.2)
  2. `-rpcservertimeout` config option which sets the amount of time the server will keep an idle client connection alive
  3. "Chunked" Transfer-Encoding: Allows a client to send a request in pieces, without the `Content-Length` header [RFC 7230 4.1](https://www.rfc-editor.org/rfc/rfc7230#section-4.1)

ACKs for top commit:
  achow101:
    ACK f16c8c67bf
  vasild:
    ACK f16c8c67bf
  polespinasa:
    ACK f16c8c67bf
  fjahr:
    utACK f16c8c67bf

Tree-SHA512: 405b59431b4d2bf118fde04b270865dee06ef980ab120d9cc1dce28e5d65dfd880a57055b407009d22f4de614bc3eebdb3e203bcd39e86cb14fbfd62195ed06a
2025-06-09 13:08:25 -07:00
Sebastian Falbesoner
e9cdaefb0a test: introduce and use CTransaction .wtxid_int property
This commits removes the `.calc_sha256` method from the CTransaction
and introduces a property `.wtxid_int` property as replacement.
2025-06-09 17:28:28 +02:00
Sebastian Falbesoner
9b3dce24a3 test: remove bare CTransaction .rehash()/.calc_sha256() calls
Since the previous commit, CTransaction object calls to the
methods `.rehash()` and `.calc_sha256()` are effectively no-ops
if the returned value is not used, so we can just remove them.
2025-06-09 17:28:24 +02:00
Sebastian Falbesoner
a2724e3ea3 test: remove txid caching in CTransaction class
Rather than txids (represented by the fields `.sha256` and `.hash`)
being stateful, simply compute them on-the-fly. This ensures that
the correct values are always returned and takes the burden of
rehashing from test writers, making the code shorter overall.
In a first step, the fields are kept at the same name with @property
functions as drop-in replacements, for a minimal diff. In later commits,
the names are changed to be more descriptive and indicating the return
type of the txid.
2025-06-09 16:55:04 +02:00
MarcoFalke
fa0b766f43 test: Remove intermittent and presumed fixed tsan race suppressions
LoadWallet was added in commit d77170d526, which
points to a traceback with BerkeleyBatch in it. Now that BDB is removed,
this can be removed as well.

The race in DatabaseBatch was added in commit
fd59670642, which does not point to a
traceback. This was likely also fixed with the BDB removal.

If not, the suppressions should be added back, mentioning that they are
intermittent and including a traceback and possibly steps to reproduce.
2025-06-09 16:28:48 +02:00
merge-script
f3bbc74664 Merge bitcoin/bitcoin#32406: policy: uncap datacarrier by default
a189d63618 add release note for datacarriersize default change (Greg Sanders)
a141e1bf50 Add more OP_RETURN mempool acceptance functional tests (Peter Todd)
0b4048c733 datacarrier: deprecate startup arguments for future removal (Greg Sanders)
63091b79e7 test: remove unnecessary -datacarriersize args from tests (Greg Sanders)
9f36962b07 policy: uncap datacarrier by default (Greg Sanders)

Pull request description:

  Retains the `-datacarrier*` args, marks them as deprecated, and does not require another startup argument for multiple OP_RETURN outputs.

  If a user has set `-datacarriersize` the value is "budgeted" across all seen OP_RETURN output scriptPubKeys. In other words the total script bytes stays the same, but can be spread across any number of outputs. This is done to not introduce an additional argument to support multiple outputs.

  I do not advise people use the option with custom arguments and it is marked as deprecated to not mislead as a promise to offer it forever. The argument itself can be removed in some future release to clean up the code and minimize footguns for users.

ACKs for top commit:
  stickies-v:
    re-ACK a189d63618
  Sjors:
    re-ACK a189d63618
  polespinasa:
    re-ACK a189d63618
  hodlinator:
    re-ACK a189d63618
  ajtowns:
    reACK a189d63618
  mzumsande:
    re-ACK a189d63618
  petertodd:
    ACK a189d63618
  theStack:
    re-ACK a189d63618
  1440000bytes:
    re-ACK a189d63618
  willcl-ark:
    ACK a189d63618
  dergoegge:
    ACK a189d63618
  fanquake:
    ACK a189d63618
  murchandamus:
    ACK a189d63618
  darosior:
    Concept ACK a189d63618.

Tree-SHA512: 3da2f1ef2f50884d4da7e50df2121bf175cb826edaa14ba7c3068a6d5b2a70beb426edc55d50338ee1d9686b9f74fdf9e10d30fb26a023a718dd82fa1e77b038
2025-06-09 08:23:56 -04:00
rkrux
b44514b876 rpc, doc: update listdescriptors RCP help
This RPC lists all the descriptors present in the wallet, not only
the ones that were imported, but also the ones generated when a
new wallet is created.

It can be verified by creating a new wallet and calling the
`listdescriptors` RPC, which will contain 8 ranged descriptors that
are created for every new wallet.

Also, update the description to get rid of "descriptor-enabled"
because this is the only wallet type available now after removal of
legacy wallets.
2025-06-09 15:15:47 +05:30
MarcoFalke
fa4b659dcd test: Explain how to reproduce zmq:: upstream race 2025-06-08 16:39:33 +02:00
Roman Zeyde
d4e212e8a6 rest: fetch spent transaction outputs by blockhash
Today, it is possible to fetch a block's spent prevouts in order to
build an external index by using the `/rest/block/HASH.json` endpoint.
However, its performance is low due to JSON serialization overhead.

We can significantly optimize it by adding a new REST endpoint, using
a binary response format:

```
$ BLOCKHASH=00000000000000000002a7c4c1e48d76c5a37902165a270156b7a8d72728a054

$ ab -k -c 1 -n 100 http://localhost:8332/rest/block/$BLOCKHASH.json
Document Length:        13278152 bytes
Requests per second:    3.53 [#/sec] (mean)
Time per request:       283.569 [ms] (mean)

$ ab -k -c 1 -n 10000 http://localhost:8332/rest/spentoutputs/$BLOCKHASH.bin
Document Length:        195591 bytes
Requests per second:    254.47 [#/sec] (mean)
Time per request:       3.930 [ms] (mean)
```

Currently, this PR is being used and tested by Bindex:

 * https://github.com/romanz/bindex-rs

This PR would allow to improve the performance of external indexers
such as electrs, ElectrumX, Fulcrum and Blockbook:

 * https://github.com/romanz/electrs (also https://github.com/Blockstream/electrs and https://github.com/mempool/electrs)
 * https://github.com/spesmilo/electrumx
 * https://github.com/cculianu/Fulcrum
 * https://github.com/trezor/blockbook
2025-06-07 20:17:50 +03:00
Luis Schwab
32d4e92b9a doc: make -DWITH_ZMQ=ON explicit on build-unix.md 2025-06-06 19:42:01 -03:00
Ava Chow
e2174378aa Merge bitcoin/bitcoin#32539: init: Configure reachable networks before we start the RPC server
12ff4be9c7 test: ensure -rpcallowip is compatible with RFC4193 (Matthew Zipkin)
c02bd3c187 config: Explain RFC4193 and CJDNS interaction in help and init error (Matthew Zipkin)
f728b6b111 init: Configure reachable networks before we start the RPC server (Matthew Zipkin)

Pull request description:

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

  `MaybeFlipIPv6toCJDNS()` relies on `g_reachable_nets` to distinguish between CJDNS addresses and other IPv6 addresses. In particular, [RFC4193](https://www.rfc-editor.org/rfc/rfc4193#section-3.1) address or "Unique Local Address" with the L-bit unset also begins with the `fc` prefix. #32433 highlights a use case for these addresses that have nothing to do with CJDNS.

  On master we don't parse init flags like `-cjdnsreachable` until *after* the HTTP server has started, causing conflicts with `-rpcallowip` because CJDNS doesn't support subnets.

  This PR ensures that `NET_CJDNS` is only present in the reachable networks list if set by `-cjdnsreachable` *before* `-rpcallowip` is checked. If it is set all `fc` addresses are assumed to be CJDNS, can not have subnets, and can't be set for `-rpcallowip`.

  I also noted this specific parameter interaction in the init help as well as the error message if configured incorrectly.

  This can be tested locally:

  `bitcoind -regtest -rpcallowip=fc00:dead:beef::/64 -rpcuser=u -rpcpassword=p`

  On master this will just throw an error that doesn't even mention IPv6 at all.

  On the branch, this will succeed and can be tested by adding the ULA to a local interface.

  On linux: `sudo ip -6 addr add fc00:dead:beef::1/64 dev lo`

  On macos: `sudo ifconfig lo0 inet6 fc00:dead:beef::1/128 add`

  then: `curl -v -g -6 --interface fc00:dead:beef::1 u:p@[::1]:18443 --data '{"method":"getblockcount"}'`

  If the `rpcallowip` option is removed, the RPC request will fail to authorize.

  Finally, adding `-cjdnsreachable` to the start up command will throw an error and specify the incompatibility:

  > RFC4193 is allowed only if -cjdnsreachable=0.

ACKs for top commit:
  achow101:
    ACK 12ff4be9c7
  tapcrafter:
    tACK 12ff4be9c7
  ryanofsky:
    Code review ACK 12ff4be9c7
  willcl-ark:
    ACK 12ff4be9c7

Tree-SHA512: a4dd70ca2bb9f6ec2c0a9463fd73985d1ed80552c674a9067ac9a86662d1c018cc275ba757cebb2993c5f3971ecf4778b95d35fe7a7178fb41b1d18b601c9960
2025-06-06 15:31:36 -07:00
Ava Chow
2053c43684 Merge bitcoin/bitcoin#32675: test: wallet: cover wallet passphrase with a null char
7cfbb8575e test: wallet: cover wallet passphrase with a null char (brunoerg)

Pull request description:

  This PR adds test coverage for the `walletpassphrase`/`walletpassphrasechange` RPC when the passphrase is incorrect due to a null character.

  For reference: https://github.com/bitcoin/bitcoin/pull/27068 introduced the usage of `SecureString` to allow null characters.

ACKs for top commit:
  maflcko:
    lgtm ACK 7cfbb8575e
  achow101:
    ACK 7cfbb8575e
  w0xlt:
    Code review ACK 7cfbb8575e
  BrandonOdiwuor:
    Code Review ACK 7cfbb8575e
  theStack:
    ACK 7cfbb8575e
  pablomartin4btc:
    cr ACK 7cfbb8575e

Tree-SHA512: ecdb48662ceb6c55c4b301ca7f537c3159ece7b66ee40ea977583ffb74bd3d06e334ab3a5639a9cde3aa6443129f412f9aea0ee5a8b73b31dba0728d0890b7f1
2025-06-06 15:12:01 -07:00
furszy
331a25cb16 test: indexes, avoid creating threads when sync runs synchronously
The indexes test call StartBackgroundSync(), which spawns a thread to run Sync(),
only for the test thread to wait for it to complete by calling IndexWaitSynced().

So, since the sync is performed synchronously, we can skip the extra thread creation
entirely and call Sync() directly.
2025-06-06 16:32:54 -04:00
kevkevinpal
95969bc58a test: added fuzz coverage to consensus/merkle.cpp
This adds a new fuzz target merkle which adds fuzz coverage to
consensus/merkle.cpp
2025-06-06 11:28:42 -04:00
Martin Zumsande
f6b782f3aa doc: Improve m_best_header documentation 2025-06-06 11:23:44 -04:00
Martin Zumsande
ee673b9aa0 validation: remove m_failed_blocks
After changes in previous commits, we now mark all blocks that descend from an invalid block
immediately as the block is found invalid. This happens both in the AcceptBlock
and ConnectBlock stages of block validation.
As a result, the pindexPrev->nStatus check in AcceptBlockHeader is now sufficient to detect
invalid blocks and checking m_failed_blocks there is no longer necessary.
2025-06-06 11:23:44 -04:00
Martin Zumsande
ed764ea2b4 validation: Add more checks to CheckBlockIndex()
This adds checks that
1) Descendants of invalid block indexes are also marked invalid
2) m_best_header cannot be invalid, and there can be no valid
block with more work than it.
2025-06-06 11:23:44 -04:00
Martin Zumsande
9a70883002 validation: in invalidateblock, calculate m_best_header right away
Before, m_best_header would be calculated only after disconnecting
multiple blocks, letting go of cs_main in the meantime.
This is in preparation for adding checks to CheckBlockIndex()
requiring that m_best_header is the most-work header not known to be invalid.

Co-authored-by: stringintech <stringintech@gmail.com>
2025-06-06 11:23:44 -04:00
Martin Zumsande
8e39f2d20d validation: in invalidateblock, mark children as invalid right away
Before, they would be marked as invalid only after disconnecting
multiple blocks, letting go of cs_main in the meantime.
This is in preparation for adding a check to
CheckBlockIndex() requiring that descendants of invalid block indexes
are always marked as invalid.
Entries from highpow_outofchain_headers are now only removed if made invalid,
no longer after inserting into setBlockIndexCandidates, because they
might still become invalid later in the second case.
This means that blocks could be inserted multiple times now into
setBlockIndexCandidates - this won't have any effect, so
behavior isn't changed.
2025-06-06 11:23:44 -04:00
Martin Zumsande
4c29326183 validation: cache all headers with enough PoW in invalidateblock
We now include blocks without HaveNumChainTxs() / lower validation status
than BLOCK_VALID_TRANSACTIONS. These checks are still performed at the
spot where we use the cache to insert into setBlockIndexCandidates.

This is in preparation for using the cache for more things than
just setBlockIndexCandidates candidates in the following commits.

Co-authored-by: stickies-v <stickies-v@protonmail.com>
2025-06-06 11:23:44 -04:00
Martin Zumsande
15fa5b5a90 validation: call InvalidBlockFound also from AcceptBlock
When a block it found invalid during acceptance (but before connection)
we now mark its descendants with BLOCK_FAILED_CHILD and update
m_best_header when these things weren't done reliably before.

This does not fix a serious bug because the flags and m_best_header were being set on a best-effort basis before
and not used for anything critical.
Setting these reliably has a slight performance cost (iterating over the
entire block index) but leads to more consistency in validation and allows removing m_failed_blocks in a later commit.
This can only be triggered by providing a block with sufficient PoW
that is otherwise invalid, so it is not a DoS vector.
2025-06-06 11:23:44 -04:00
MarcoFalke
fa9cfdf3be ci: [doc] fix url redirect
This solves an URL redirect. (The commit is also used to trigger the test-each-commit CI)
2025-06-06 09:00:27 +02:00
MarcoFalke
fac60b9c48 ci: Rewrite test-each-commit as py script 2025-06-06 09:00:24 +02:00
Sebastian Falbesoner
8713e8060d depends: fix SHA256SUM command on OpenBSD (use GNU mode output)
On OpenBSD, the `sha256` command by default outputs hashsums on files in
"BSD" mode, looking like this:

$ sha256 ~/.vimrc
SHA256 (/home/thestack/.vimrc) = 6ba69d100e8c5ca0488ded6293d4e5f740a6a5d5ace96cbcf0599c18d27389e4

This is not compatible with our depends commands, which expect the
hashes to be on the first column (to be extracted via `cut -d" " -f1`).
Fix this by switching to GNU mode output, looking like this:

$ sha256 -r ~/.vimrc
6ba69d100e8c5ca0488ded6293d4e5f740a6a5d5ace96cbcf0599c18d27389e4 /home/thestack/.vimrc

Without this change, the multiprocess depends build fails with the following output:

$ gmake -C depends MULTIPROCESS=1 NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_QR=1 NO_WALLET=1 NO_ZMQ=1 NO_USDT=1
[ ..... ]
Extracting native_libmultiprocess...
sha256: /home/thestack/bitcoin/depends/work/build/x86_64-unknown-openbsd7.7/native_libmultiprocess/-2bc902f4693/.src-ipc-libmultiprocess.tar.hash: no properly formatted checksum lines found
gmake: *** [funcs.mk:342: /home/thestack/bitcoin/depends/work/build/x86_64-unknown-openbsd7.7/native_libmultiprocess/-2bc902f4693/.stamp_extracted] Error 1
2025-06-06 02:02:30 +02:00
Sebastian Falbesoner
2d938720bd depends: add patch to fix capnp build on OpenBSD
see https://github.com/capnproto/capnproto/pull/2308
2025-06-06 01:32:00 +02:00
Sjors Provoost
0a4ee93529 wallet: use PSBTError::EXTERNAL_SIGNER_NOT_FOUND
Instead of throwing a runtime error, let the caller decide how to handle a missing signer.

GUI code was already in place to handle this, but it was unused until this commit.

Fixes #32426

Additionally use LogWarning instead of std::cerr.
2025-06-05 11:46:08 +02:00
Sjors Provoost
8ba2f9b7c8 refactor: use util::Result for GetExternalSigner()
This commit does not change behavior, except that the error message no longer contains the function name.
2025-06-05 11:32:23 +02:00
merge-script
ae024137bd Merge bitcoin/bitcoin#32496: depends: drop ltcg for Windows Qt
9653ebc053 depends: remove support for Windows Qt LTO builds (fanquake)

Pull request description:

  The related Windows patches were dropped in 5e794e6202, and "Cross-compiling does not support LTO." (from #30997).

ACKs for top commit:
  maflcko:
    lgtm ACK 9653ebc053

Tree-SHA512: 40ae7b17669bf87f2e848055e85e1a6c946f0bb0bc1674e18f1622ec4a0613fe955a4daf83928c9375035dac289ce2a72dd7f347b15f86d108157f9da9499945
2025-06-05 10:54:08 +02:00
merge-script
6a2ff67909 Merge bitcoin/bitcoin#32679: doc: update tor docs to use bitcoind binary from path
4ce53495e5 doc: update tor docs to use bitcoind binary from path (ismaelsadeeq)

Pull request description:

  I noticed this while trying to run a node over Tor.
  Using `./bitcoind` as the executable path is incorrect.

  This is a simple documentation update PR that fixes the path by removing the prefix and just
  having `bitcoind`  as the usage example targeting those who have Bitcoin Core in their PATH.

ACKs for top commit:
  davidgumberg:
    ACK 4ce53495e5
  janb84:
    ACK 4ce53495e5
  jonatack:
    ACK 4ce53495e5

Tree-SHA512: a23c94a175f77d66ee1a81599a15a809ad768090eebb619c8e4a67b8a020a2256da4f40cec3c00ec35775b265d3c53cdb70c09fbed48d399416fbc9156ebff31
2025-06-05 10:38:40 +02:00