Commit graph

39565 commits

Author SHA1 Message Date
merge-script
a3752d0f9c
Merge ElementsProject/elements#1533: Prepare 23.3.2
43f9542cad Bump version to 23.3.2 final (Pablo Greco)

Pull request description:

  Only version bump changes since rc2

ACKs for top commit:
  tomt1664:
    ACK 43f9542cad
  delta1:
    ACK 43f9542cad; only changes RC version for release

Tree-SHA512: a3424d432a8adefa3e4d31d28781e20e8d7fb01ad10286455a722d138621a3d21fc608eb6300085f26f71fbd999866a5b5e062fc1f0e329b41e8cc6ffeb11e8b
2026-02-13 18:08:10 +02:00
Pablo Greco
43f9542cad
Bump version to 23.3.2 final 2026-02-13 05:57:46 -08:00
merge-script
52a33e6b66
Merge ElementsProject/elements#1531: Prepare 23.3.2rc2
73db0cf72b Bump version to 23.3.2-rc2 (Pablo Greco)
6544256fcb Update manpages (Pablo Greco)
4c79d5a572 fix: use liquidnetwork or liquidtestnet for uri in elements mode (Byron Hambly)
8f28d82f57 docs: add github-merge.py process for merging PRs (Byron Hambly)
6c7788adf3 Avoid Simplicity header dependency propogation (Russell O'Connor)

Pull request description:

  Updates master to 6bb916a57f which includes fixes for simplicity header dependency and qr code generation for QT

ACKs for top commit:
  delta1:
    ACK 73db0cf72b; diff looks as expected, tested locally successfully

Tree-SHA512: d23312a81033b759466f9bc2d8bbb0bfcdd5bfd0a1d80b101e8461e62a151841910310e82ed8a1ba4ed6bb8a363f53dc2e8e5674c27b9ebafe02169a88b08ed9
2026-02-04 13:21:12 +02:00
Pablo Greco
73db0cf72b
Bump version to 23.3.2-rc2 2026-02-03 20:17:18 -08:00
Pablo Greco
6544256fcb
Update manpages 2026-02-03 20:17:18 -08:00
Pablo Greco
672fbda25e
Merge branch 'master' into elem-23.3.2rc2 2026-02-03 20:03:19 -08:00
merge-script
6bb916a57f
Merge ElementsProject/elements#1530: fix: use liquidnetwork or liquidtestnet for qr uri
4c79d5a572 fix: use liquidnetwork or liquidtestnet for uri in elements mode (Byron Hambly)

Pull request description:

  fixes #1529

ACKs for top commit:
  tomt1664:
    ACK 4c79d5a572
  psgreco:
    ACK 4c79d5a572

Tree-SHA512: 00862c3851bd1663ed17dfde9ef155840d4d735b3e61ad890155dccdc9cb7fb4fc086021a9ae1a1030ff8e809dc6ffb46a5aeed35d3c5625b44f65ec6cdae421
2026-01-31 08:12:36 -08:00
Byron Hambly
4c79d5a572
fix: use liquidnetwork or liquidtestnet for uri in elements mode 2026-01-30 10:54:24 +02:00
merge-script
344581cabd
Merge ElementsProject/elements#1528: docs: add github-merge.py process for merging PRs
8f28d82f57 docs: add github-merge.py process for merging PRs (Byron Hambly)

Pull request description:

  Documents how to merge PRs using the github-merge.py script from Bitcoin maintainer tools repo.

ACKs for top commit:
  psgreco:
    ACK 8f28d82f57

Tree-SHA512: b263dd7715fa71926ceeae053e453a4a19b64fa89c88cb0f84fa15bafbcc1051f35ca4f28a05f41dfc8d3af1d1de9eb2bb6cd832867cf7d7d7772a3c7267777b
2026-01-25 10:28:20 -08:00
Byron Hambly
8f28d82f57
docs: add github-merge.py process for merging PRs 2026-01-23 12:09:21 +02:00
merge-script
e360a967b6
Merge ElementsProject/elements#1518: Avoid Simplicity header dependency propogation
6c7788adf3 Avoid Simplicity header dependency propogation (Russell O'Connor)

Pull request description:

  The problem with including <simplicity/elements/env.h> in interpreter.h is that now everyone who needs to include interpreter.h also needs access to Simplicity's header files too.

  This commit breaks that dependency chain by using forward declarations.  It will pay signifigant dividends when elements switches to CMake.

ACKs for top commit:
  delta1:
    ACK 6c7788a; built and tested locally
  apoelstra:
    ACK 6c7788adf3; successfully ran local tests

Tree-SHA512: 78d043a094f0a2bb51e0f103313ae568b42ec2852d8fe9a3fbbcad9c0fbf6829ef1347f83bfd361547ec165c01965e7342188a38d8faacfcf90ef70c5b7001f6
2026-01-22 14:52:00 +02:00
Tom Trevethan
7d23662e5a
Merge pull request #1527 from psgreco/elem-23.3.2rc1
Prepare 23.3.2rc1
2026-01-21 16:39:25 +00:00
Pablo Greco
df5f043e06
Update manpages 2026-01-20 16:30:28 -08:00
Pablo Greco
af662eb18e
Bump version to 23.3.2-rc1 2026-01-20 15:08:17 -08:00
Pablo Greco
116c2b43b1
Update copyright year to 2026 2026-01-20 15:07:35 -08:00
Pablo Greco
029c24a8e8
Merge branch 'master' into elem-23.3.2rc1 2026-01-20 15:01:13 -08:00
Pablo Greco
6d29a59f61
Merge pull request #1522 from delta1/2026-01-tweakfedpegscript
rpc!: change tweakfedpegscript to output both p2wsh and p2shwsh addresses
2026-01-20 08:02:40 -08:00
Byron Hambly
5d64e8945d
rpc!: change tweakfedpegscript to output P2WSH address
Changes tweakfedpegscript to return both p2wsh and p2shwsh version of
the tweaked address.

"address" has been removed from the result and replaced with "p2wsh" and
"p2shwsh".
2026-01-20 15:03:08 +02:00
merge-script
c1a8b82968
Merge ElementsProject/elements#1526: ci: fix windows jobs for 23.x
75bd182f82 ci(windows): pin jom to 1.1.2 (Byron Hambly)
aad3baf6f0 ci: update qt link for windows job (Byron Hambly)

Pull request description:

  copy of #1520 for elements-23.x

ACKs for top commit:
  delta1:
    ACK [75bd182](https://github.com/ElementsProject/elements/pull/1526/commits/75bd182f821baf6d1221d61e864a6009bc7854ee); CI changes only and CI passed successfully

Tree-SHA512: 237f4aea13f36da5840fcb34a04ee8fc08dceb8e841fb13b7bbe61885d35661ea95e3228a996634f0a75f481a1cf36a5131404c9033ddab52c37c333385d6994
2026-01-20 11:35:27 +02:00
merge-script
166bc34054
Merge ElementsProject/elements#1525: miner: fix addPackageTxs unsigned integer overflow
70d2293e62 miner: fix `addPackageTxs` unsigned integer overflow (ismaelsadeeq)

Pull request description:

  Cherry-pick of https://github.com/bitcoin/bitcoin/pull/33475

ACKs for top commit:
  delta1:
    ACK 70d2293e62; ran tests locally

Tree-SHA512: e9e470fe4ceccd282bc12e942cfde4e3b1c6abfa9747df93a4975c58ac17ff1266f26d35b1bc5b4887e8b6dfdba3380d67144ae35f2ee1489fa355ab211f2fc5
2026-01-20 10:41:29 +02:00
Byron Hambly
75bd182f82
ci(windows): pin jom to 1.1.2
(cherry picked from commit 656ad6d1fb)
2026-01-20 09:49:11 +02:00
Byron Hambly
aad3baf6f0
ci: update qt link for windows job
(cherry picked from commit 2161cf464d)
2026-01-20 09:48:55 +02:00
ismaelsadeeq
70d2293e62 miner: fix addPackageTxs unsigned integer overflow 2026-01-19 16:51:23 +00:00
merge-script
9a74bc9e2d
Merge ElementsProject/elements#1519: simplicity: update to d1905055
87c0b44f78 Squashed 'src/simplicity/' changes from 6d503ea4f8..49b96499a6 (Byron Hambly)
73d1e521bf docs: add simplicity code update instructions (Byron Hambly)

Pull request description:

  Updates Simplicity C source subtree from current master BlockstreamResearch/Simplicity@d190505509

  Adds new document describing the process.

  Pushed the C-master branch subtree split to my repo [delta1/simplicity/tree/C-master](https://github.com/delta1/simplicity/tree/C-master) and upstreamed in BlockstreamResearch/Simplicity#330

ACKs for top commit:
  delta1:
    ACK 4539002bee; compiled and tested locally

Tree-SHA512: e9fab8baa728ac122597bf2e3c5ae4fe1c5956c655fc336e1cc7a2be591f1deebcab32004a8b6b4ad359c51154ad47bca5f40c21d06823d5d059a6d66efb15af
2026-01-13 09:04:55 +02:00
Byron Hambly
4539002bee
Merge commit '87c0b44f78' into 2026-01-simplicity-update 2026-01-12 12:56:33 +02:00
Byron Hambly
87c0b44f78 Squashed 'src/simplicity/' changes from 6d503ea4f8..49b96499a6
49b96499a6 Replace Bitcoin Relative Timelock Jets
89ddb43eed Mark depricated parts of the TxEnv as obsolete
ff5d6fe4f7 Deprecate Broken Jets
ae008201ac Test Bitcoin jet deserialization
e81b68f197 Add GenPrimitive --bitcoin option
7887d16f24 Bitcoin specific fee jets
68603073b3 Bitcoin specific environment
ae3287e60f Refactor Makefile
99e3804e2d C: replace string initializations with arrays
c3dd9331cd Allow building on non-intel systems

git-subtree-dir: src/simplicity
git-subtree-split: 49b96499a6bb93b31d2f712fc1d4524f341ae640
2026-01-12 12:56:33 +02:00
Byron Hambly
73d1e521bf
docs: add simplicity code update instructions 2026-01-12 12:53:09 +02:00
Pablo Greco
a98bad738a
Merge pull request #1520 from delta1/2026-01-windows-qt
ci: update win64 native tasks
2026-01-09 09:04:16 -08:00
Byron Hambly
656ad6d1fb
ci(windows): pin jom to 1.1.2 2026-01-09 10:12:19 +02:00
Byron Hambly
2161cf464d
ci: update qt link for windows job 2026-01-08 09:07:48 +02:00
Russell O'Connor
6c7788adf3 Avoid Simplicity header dependency propogation
The problem with including <simplicity/elements/env.h> in interpreter.h is that
now everyone who needs to include interpreter.h also needs access to
Simplicity's header files too.

This commit breaks that dependency chain by using forward declarations.  It will
pay signifigant dividends when elements switches to CMake.
2025-12-24 09:50:30 -05:00
merge-script
720238c41f
Merge ElementsProject/elements#1511: Introduce per-txin sighash midstate cache for legacy/p2sh/segwitv0 scripts
eb64d2486f Merge bitcoin/bitcoin#32473: Introduce per-txin sighash midstate cache for legacy/p2sh/segwitv0 scripts (merge-script)

Pull request description:

  Backport of https://github.com/bitcoin/bitcoin/pull/32473

  Additional cache index bit added for sighash combination with `SIGHASH_RANGEPROOF`

ACKs for top commit:
  delta1:
    ACK eb64d2486f

Tree-SHA512: 94014e726ff16473809672f3e01a8e4d11c4abd38b3ae3ae64b8b9ae61be2e3c246157dca5a3a3afc4b85cc8ec69e23181af8f11c36e0b43cfac2dcb3e2e8d70
2025-11-27 16:33:38 +02:00
merge-script
6664587c2f
Merge ElementsProject/elements#1515: v30 patches
b7ee5fb8a5 Merge bitcoin/bitcoin#33001: test: Do not pass tests on unhandled exceptions (merge-script)
1ac1f75ec0 Merge bitcoin/bitcoin#32765: test: Fix list index out of range error in feature_bip68_sequence.py (merge-script)
0f06cebc61 Merge bitcoin/bitcoin#33395: net: do not apply whitelist permissions to onion inbounds (merge-script)
53a5bd0790 Merge bitcoin/bitcoin#33296: net: check for empty header before calling FillBlock (Ava Chow)

Pull request description:

  Cherry-picks of bugfix patches included in the Bitcoin v30 release.

  net: check for empty header before calling FillBlock
  https://github.com/bitcoin/bitcoin/pull/33296

  net: do not apply whitelist permissions to onion inbounds
  https://github.com/bitcoin/bitcoin/pull/33395

  test: Fix list index out of range error in feature_bip68_sequence.py
  https://github.com/bitcoin/bitcoin/pull/32765

  test: Do not pass tests on unhandled exceptions
  https://github.com/bitcoin/bitcoin/pull/33001

ACKs for top commit:
  delta1:
    ACK b7ee5fb8a5

Tree-SHA512: 7fee367e549a0a5f8b2461be317dc8469feb0f907993f86638e9ca8ca333f9643fa90ecec4dd4edeba2d7e9098aa953f047dbaa0d35a9fc75a68fb62391c7616
2025-11-27 12:56:42 +02:00
merge-script
7820602f54
Merge ElementsProject/elements#1513: Don't punish peers for consensus-invalid txs
05bd984da9 updated script-verify-flag failure messagesin p2p_segwit.py (Tom Trevethan)
4b301666ff Merge bitcoin/bitcoin#33050: net, validation: don't punish peers for consensus-invalid txs (Ava Chow)

Pull request description:

  Backport of https://github.com/bitcoin/bitcoin/pull/33050

ACKs for top commit:
  delta1:
    ACK 05bd984da9

Tree-SHA512: ebb193aa4122a3a577039bbe7d912fdf598a6b653734523ad29a39dbeea9d392de84636c4d5e4f45f7c111c63843518534e99ad4b37605b094c352bb9b0de725
2025-11-26 13:26:10 +02:00
Tom Trevethan
05bd984da9 updated script-verify-flag failure messagesin p2p_segwit.py 2025-11-26 10:42:59 +00:00
Ava Chow
4b301666ff Merge bitcoin/bitcoin#33050: net, validation: don't punish peers for consensus-invalid txs
876dbdfb4702410dfd4037614dc9298a0c09c63e tests: drop expect_disconnect behaviour for tx relay (Anthony Towns)
b29ae9efdfeeff774e32ee433ce67d8ed8ecd49f validation: only check input scripts once (Anthony Towns)
266dd0e10d08c0bfde63205db15d6c210a021b90 net_processing: drop MaybePunishNodeForTx (Anthony Towns)

Pull request description:

  Because we do not discourage nodes for transactions we consider non-standard, we don't get any DoS protection from this check in adversarial scenarios, so remove the check entirely both to simplify the code and reduce the risk of splitting the network due to changes in tx relay policy.

  Then, because we no longer make use of the distinction between consensus and standardness failures during script validation, don't re-validate each script with only-consensus rules, reducing the cost to us of transactions that we won't relay.

ACKs for top commit:
  achow101:
    ACK 876dbdfb4702410dfd4037614dc9298a0c09c63e
  darosior:
    re-ACK 876dbdfb4702410dfd4037614dc9298a0c09c63e
  sipa:
    re-ACK 876dbdfb4702410dfd4037614dc9298a0c09c63e
  glozow:
    ACK 876dbdfb4702410dfd4037614dc9298a0c09c63e

Tree-SHA512: 8bb0395766dde54fc48f7077b80b88e35581aa6e3054d6d65735965147abefffa7348f0850bb3d46f6c2541fd384ecd40a00a57fa653adabff8a35582e2d1811
2025-11-26 10:22:33 +00:00
merge-script
53dc403306
Merge ElementsProject/elements#1514: Mitigate disk filling attacks by rate limiting Log writing
d23b6c86d0 [log] Introduce log rate limiter class (Niklas Gögge)
817c68a64f Merge bitcoin/bitcoin#24464: logging: Add severity level to logs (laanwj)

Pull request description:

  Mitigation of [CVE-2025-54604](https://bitcoincore.org/en/2025/10/24/disclose-cve-2025-54604/) and [CVE-2025-54605 - Disk filling from invalid blocks](https://bitcoincore.org/en/2025/10/24/disclose-cve-2025-54605/)

  Port of https://github.com/bitcoin/bitcoin/pull/21603 (the later PR merged for inclusion in bitcoin v30 https://github.com/bitcoin/bitcoin/pull/32604 relies on `std::source_location` in C++20). 21603 implements `SourceLocation ` and `SourceLocationHasher` for use with C++17.

  Dependent on: bitcoin/bitcoin#24464: logging: Add severity level to logs

ACKs for top commit:
  delta1:
    ACK d23b6c86d0

Tree-SHA512: 0e49eb9fa46e65c7f5deb5f4cc40f25812756510fbe7eb16140e482e0259c91b4584e65cb43a7d83b7aa9dcf586fd26436aed4efa2757de32cc3f3c3a71acbf0
2025-11-26 11:59:16 +02:00
merge-script
946db0fe20
Merge ElementsProject/elements#1512: Detect witness stripping without re-running Script checks
0cb5c660bb Merge bitcoin/bitcoin#33105: validation: detect witness stripping without re-running Script checks (merge-script)

Pull request description:

  Backport of https://github.com/bitcoin/bitcoin/pull/33105

ACKs for top commit:
  delta1:
    ACK 0cb5c660bb

Tree-SHA512: 6e982a18450edfe8c8f6ce0087af4d084f04dd39c0113144ab367802a2aee7e991899941c95e4f01e9d67248e7b87810b23d6fcb687c0582f6b69b72583ae829
2025-11-26 11:25:34 +02:00
merge-script
b7ee5fb8a5 Merge bitcoin/bitcoin#33001: test: Do not pass tests on unhandled exceptions
faa3e684118bffa7a98cf76eeeb59243219df900 test: Log KeyboardInterrupt as exception (MarcoFalke)
fa30b34026f76a5b8af997152fced2d281782e0d test: Do not pass tests on unhandled exceptions (MarcoFalke)

Pull request description:

  Currently the functional tests are problematic, because they pass, even if they encounter an unhanded exception.

  Fix this by handling all exceptions: Catch `BaseException` as fallback and mark it as failure.

  Can be tested via:

  ```diff
  diff --git a/test/functional/wallet_disable.py b/test/functional/wallet_disable.py
  index da6e5d408f..ecc41fb041 100755
  --- a/test/functional/wallet_disable.py
  +++ b/test/functional/wallet_disable.py
  @@ -19,6 +19,7 @@ class DisableWalletTest (BitcoinTestFramework):
           self.wallet_names = []

       def run_test (self):
  +        import sys;sys.exit("fatal error")
           # Make sure wallet is really disabled
           assert_raises_rpc_error(-32601, 'Method not found', self.nodes[0].getwalletinfo)
           x = self.nodes[0].validateaddress('3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy')
  ```

  Previously, the test would pass. With this patch, it would fail.

ACKs for top commit:
  enirox001:
    Looks good to me—ACK faa3e68
  stickies-v:
    re-ACK faa3e684118bffa7a98cf76eeeb59243219df900
  pablomartin4btc:
    tACK faa3e684118bffa7a98cf76eeeb59243219df900

Tree-SHA512: 11ecd5201982e2c776e48d98834b17c15a415306a95524bc702daeba20a316aac797748e9592be8db575597804f149ee7ef104416037cc9e5891758625810e2d
2025-11-25 16:25:39 +00:00
merge-script
1ac1f75ec0 Merge bitcoin/bitcoin#32765: test: Fix list index out of range error in feature_bip68_sequence.py
e285e691b7a311e278f89e9fe423716de1ee268b test: Fix list index out of range error in feature_bip68_sequence.py (zaidmstrr)

Pull request description:

  Fixes [#32334](https://github.com/bitcoin/bitcoin/issues/32334)

  The test `feature_bip68_sequence.py` fails with `IndexError: list index out of range` error due to a mismatch between the number of inputs requested (at random) and the number of UTXOs available. The error is reproducible with the randomseed:
  ```
  $ ./build/test/functional/feature_bip68_sequence.py --randomseed 6169832640268785903
  ```
  This PR adds a valid upper bound to randomly select the inputs.

ACKs for top commit:
  maflcko:
    lgtm ACK e285e691b7a311e278f89e9fe423716de1ee268b
  Prabhat1308:
    re-ACK [`e285e69`](https://github.com/bitcoin/bitcoin/pull/32765/commits/e285e691b7a311e278f89e9fe423716de1ee268b)
  theStack:
    ACK e285e691b7a311e278f89e9fe423716de1ee268b

Tree-SHA512: 2e5e19d5db2880915f556ed4444abed94e9ceb1ecee5f857df5616040c850dae682aaa4ade3060c48acb16676df92ba81c3af078c1958965e9e874e7bb489388
2025-11-25 13:39:58 +00:00
merge-script
0f06cebc61 Merge bitcoin/bitcoin#33395: net: do not apply whitelist permissions to onion inbounds
f563ce90818d486d2a199439d2f6ba39cd106352 net: Do not apply whitelist permission to onion inbounds (Martin Zumsande)

Pull request description:

  Tor inbound connections do not reveal the peer's actual network address. Do not apply whitelist permissions to them since address-based matching is ineffective.

ACKs for top commit:
  darosior:
    ACK f563ce90818d486d2a199439d2f6ba39cd106352
  furszy:
    ACK f563ce90818d486d2a199439d2f6ba39cd106352
  vasild:
    ACK f563ce90818d486d2a199439d2f6ba39cd106352

Tree-SHA512: 49ae70e382fc2f78b7073553fe649a6843a41214b2986ea7f77e285d02b7bd00fe0320a1b71d1aaca08713808fb14af058f0b1f19f19adb3a77b97cb9d3449ce
2025-11-25 13:39:28 +00:00
Ava Chow
53a5bd0790 Merge bitcoin/bitcoin#33296: net: check for empty header before calling FillBlock
8b6264768030db1840041abeeaeefd6c227a2644 test: send duplicate blocktxn message in p2p_compactblocks.py (Eugene Siegel)
5e585a0fc4fd68dd7b4982054b34deae2e7aeb89 net: check for empty header before calling FillBlock (Eugene Siegel)

Pull request description:

  This avoids an Assume crash if multiple blocktxn messages are received. The first call to `FillBlock` would make the header empty via `SetNull` and the call right before the second `FillBlock` would crash [here](689a321976/src/net_processing.cpp (L3333)) since `LookupBlockIndex` won't find anything. Fix that by checking for an empty header before the Assume.

ACKs for top commit:
  instagibbs:
    reACK https://github.com/bitcoin/bitcoin/pull/33296/commits/8b6264768030db1840041abeeaeefd6c227a2644
  fjahr:
    tACK 8b6264768030db1840041abeeaeefd6c227a2644
  achow101:
    ACK 8b6264768030db1840041abeeaeefd6c227a2644
  mzumsande:
    Code Review ACK 8b6264768030db1840041abeeaeefd6c227a2644

Tree-SHA512: d43a6f652161d4f7e6137f207a3e95259fc51509279d20347b1698c91179c39c8fcb75d2668b13a6b220f478a03578573208a415804be1d8843acb057fa1a73a
2025-11-25 12:58:39 +00:00
Niklas Gögge
d23b6c86d0 [log] Introduce log rate limiter class
The LogRatelimiter class implements a fixed window rate limiter. The
rate limiter allows a fixed amount of bytes to be consumed within a
fixed time window.

[log] Introduce source location type

The SourceLocation type stores the filename and line of a source code
location.
In a later commit we use this type as the key type in an unordered map
and set to keep track of rate limters for each location.

[config] Add -ratelimitlogging config option

The -ratelimitlogging can be used to enable/disable the rate limiting to
disk. Rate limiting is enabled by default.

[log] Add two new categories for unconditional logging

We create two new categories `UNCONDITIONAL_ALWAYS` and
`UNCONDITIONAL_RATE_LIMITED` that are always enabled by default.

LogPrintf now logs using the `UNCONDITIONAL_RATE_LIMITED` category which
will start to apply rate limiting in a later commit.

For some log locations it might be safe to allow more frequent logging
without rate limiting. These locations should use the
`UNCONDITIONAL_ALWAYS` category.

[validation] Exempt UpdateTipLog from rate limiting

UpdateTipLog logs everytime a new tip is activated. This occurs at an
increased frequency during IBD and should therefore be exempt from rate
limiting.

[log] Add rate limiting to LogPrintf

To mitigate disk filling attacks caused by unsafe usages of LogPrintf,
we rate limit LogPrintf by using the fixed window rate limiter
(BCLog::LogRatelimiter) introduced in an earlier commit.

The rate limiting logic is applied per source location instead of
globally. A source location is allowed to log up to 1 MiB per hour.
Source locations that violate the limit will have their logs supressed
for up to one hour.

[test util] Mark ~DebugLogHelper as noexcept(false)

We mark ~DebugLogHelper as noexcept(false) to be able to catch the
exception it throws. This lets us use it in test in combination with
BOOST_CHECK_THROW and BOOST_CHECK_NO_THROW to check that certain log
messages are (not) logged.

[test] Check for expected log rate limiting messages

[test] Test for expected file size changes when rate limiting is enabled

[test] Check that log rate limiting is disabled for exempt source locations

[test] Check that rate limiting can be disabled
2025-11-24 13:36:23 +00:00
laanwj
817c68a64f Merge bitcoin/bitcoin#24464: logging: Add severity level to logs
e11cdc9303  logging: Add log severity level to net.cpp (klementtan)
a8290649a6 logging: Add severity level to logs. (klementtan)

Pull request description:

  **Overview**: This PR introduces a new macro, `LogPrintLevel`, that allows developers to add logs with the severity level. Additionally, it will also print the log category if it is specified.

  Sample log:
  ```
  2022-03-04T16:41:15Z [opencon] [net:debug] trying connection XX.XX.XXX.XXX:YYYYY lastseen=2.7hrs
  ```

  **Motivation**: This feature was suggested in #20576 and I believe that it will bring the following benefits:
  * Allow for easier filtering of logs in `debug.log`
  * Can be extended to allow users to select the minimum level of logs they would like to view (not in the scope of this PR)

  **Details**:
  * New log format. `... [category:level]...`. ie:
    * Do not print category if `category == NONE`
    * Do not print level if `level == NONE`
    * If `category == NONE` and `level == NONE`, do not print any fields (current behaviour)
  * Previous logging functions:
    * `LogPrintf`:  no changes in log as it calls `LogPrintf_` with `category = NONE` and `level = NONE`
    * `LogPrint`: prints additional `[category]` field as it calls `LogPrintf_` with `category = category` and `level = NONE`
  * `net.cpp`: As a proof of concept, updated logs with obvious severity (ie prefixed with `Warning/Error:..`) to use the new logging with severity.

  **Testing**:
  * Compiling and running `bitcoind` with this PR should instantly display logs with the category name (ie `net/tor/...`)
  * Grepping for `net:debug` in `debug.log` should display the updated logs with severity level:
    <details>
    <summary>Code</summary>

    ```
    $ grep "net:debug" debug.log

    2022-03-04T16:41:15Z [opencon] [net:debug] trying connection XXX:YYY lastseen=2.7hrs
    2022-03-04T16:41:16Z [opencon] [net:debug] trying connection XXX:YYY lastseen=16.9hrs
    2022-03-04T16:41:17Z [opencon] [net:debug] trying connection XXX:YYY lastseen=93.2hrs
    2022-03-04T16:41:18Z [opencon] [net:debug] trying connection XXX:YYY lastseen=2.7hrs
    ```
    </details>

ACKs for top commit:
  laanwj:
    Code review and lightly tested ACK e11cdc9303

Tree-SHA512: 89a8c86667ccc0688e5acfdbd399aac1f5bec9f978a160e40b0210b0d9b8fdc338479583fc5bd2e2bc785821363f174f578d52136d228e8f638a20abbf0a568f
2025-11-24 12:33:33 +00:00
merge-script
eb64d2486f Merge bitcoin/bitcoin#32473: Introduce per-txin sighash midstate cache for legacy/p2sh/segwitv0 scripts
83950275eddacac56c58a7a3648ed435a5593328 qa: unit test sighash caching (Antoine Poinsot)
b221aa80a081579b8d3b460e3403f7ac0daa7139 qa: simple differential fuzzing for sighash with/without caching (Antoine Poinsot)
92af9f74d74e76681f7d98f293eab226972137b4 script: (optimization) introduce sighash midstate caching (Pieter Wuille)
8f3ddb0bccebc930836b4a6745a7cf29b41eb302 script: (refactor) prepare for introducing sighash midstate cache (Pieter Wuille)
9014d4016ad9351cb59b587541895e55f5d589cc tests: add sighash caching tests to feature_taproot (Pieter Wuille)

Pull request description:

  This introduces a per-txin cache for sighash midstate computation to the script interpreter for legacy (bare), P2SH, P2WSH, and (as collateral effect, but not actually useful) P2WPKH. This reduces the impact of certain types of quadratic hashing attacks that use standard transactions. It is not known to improve the situation for attacks involving non-standard transaction attacks.

  The cache works by remembering for each of the 6 sighash modes a `(scriptCode, midstate)` tuple, which gives a midstate `CSHA256` object right before the appending of the sighash type itself (to permit all 256, rather than just the 6 ones that match the modes). The midstate is only reused if the `scriptCode` matches. This works because - within a single input - only the sighash type and the `scriptCode` affect the actual sighash used.

  The PR implements two different approaches:
  * The initial commits introduce the caching effect always, for both consensus and relay relation validation. Despite being primarily intended for improving the situation for standard transactions only, I chose this approach as the code paths are already largely common between the two, and this approach I believe involves fewer code changes than a more targetted approach, and furthermore, it should not hurt (it may even help common multisig cases slightly).
  * The final commit changes the behavior to only using the cache for non-consensus script validation. I'm open to feedback about whether adding this commit is worth it.

  Functional tests are included that construct contrived cases with many sighash types (standard and non-standard ones) and `OP_CODESEPARATOR`s in all script types (including P2TR, which isn't modified by this PR).

ACKs for top commit:
  achow101:
    ACK 83950275eddacac56c58a7a3648ed435a5593328
  dergoegge:
    Code review ACK 83950275eddacac56c58a7a3648ed435a5593328
  darosior:
    re-ACK 83950275eddacac56c58a7a3648ed435a5593328

Tree-SHA512: 65ae8635429a4d563b19969bac8128038ac2cbe01d9c9946abd4cac3c0780974d1e8b9aae9bb83f414e5d247a59f4a18fef5b37d93ad59ed41b6f11c3fe05af4
2025-11-21 15:55:19 +00:00
merge-script
0cb5c660bb Merge bitcoin/bitcoin#33105: validation: detect witness stripping without re-running Script checks
27aefac42505e9c083fa131d3d7edbec7803f3c0 validation: detect witness stripping without re-running Script checks (Antoine Poinsot)
2907b58834ab011f7dd0c42d323e440abd227c25 policy: introduce a helper to detect whether a transaction spends Segwit outputs (Antoine Poinsot)
eb073209db9efdbc2c94bc1f535a27ec6b20d954 qa: test witness stripping in p2p_segwit (Antoine Poinsot)

Pull request description:

  Since it was introduced in 4eb515574e (#18044), the detection of a stripped witness relies on running the Script checks 3 times. In the worst case, this consists in running Script validation for every single input 3 times.

  Detection of a stripped witness is necessary because in this case wtxid==txid, and the transaction's wtxid must not be added to the reject filter or it could allow a malicious peer to interfere with txid-based orphan resolution as used in 1p1c package relay.

  However it is not necessary to run Script validation to detect a stripped witness (much less so doing it 3 times in a row). There are 3 types of witness program: defined program types (Taproot, P2WPKH and P2WSH), undefined types, and the Pay-to-anchor carve-out.

  For defined program types, Script validation with an empty witness will always fail (by consensus). For undefined program types, Script validation is always going to fail regardless of the witness (by standardness). For P2A, an empty witness is never going to lead to a failure.

  Therefore it holds that we can always detect a stripped witness without re-running Script validation. However this might lead to more "false positives" (cases where we return witness stripping for an otherwise invalid transaction) than the existing implementation. For instance a transaction with one P2PKH input with an invalid signature and one P2WPKH input with its witness stripped. The existing implementation would treat it as consensus invalid while the implementation in this PR would always consider it witness stripped.

  h/t AJ: this essentially implements a variant of https://github.com/bitcoin/bitcoin/pull/33066#issuecomment-3135258539.

ACKs for top commit:
  sipa:
    re-ACK 27aefac42505e9c083fa131d3d7edbec7803f3c0
  Crypt-iQ:
    re-ACK 27aefac42505e9c083fa131d3d7edbec7803f3c0
  glozow:
    reACK 27aefac42505e9c083fa131d3d7edbec7803f3c0

Tree-SHA512: 70cf76b655b52bc8fa2759133315a3f11140844b6b80d9de3c95f592050978cc01a87bd2446e3a9c25cc872efea7659d6da3337b1a709511771fece206e9f149
2025-11-21 00:13:00 +00:00
merge-script
98bd7180c2
Merge ElementsProject/elements#1510: Merge bitcoin#32530: node: cap -maxmempool and -dbcache for 32 bit systems.
8ea4b7aae9 Merge bitcoin/bitcoin#32530: node: cap `-maxmempool` and `-dbcache` values for 32-bit (merge-script)

Pull request description:

  Backport of https://github.com/bitcoin/bitcoin/pull/32530

ACKs for top commit:
  delta1:
    ACK 8ea4b7aae9

Tree-SHA512: fc8aea76fd49e05ca2499c40e657451890d84b5424c124b594768821a231138eef64d9b331ccbfa7a2f0e224def45f7f4630a15a7a609d32b68ebfcba76ac64b
2025-11-19 10:16:33 +02:00
merge-script
8ea4b7aae9 Merge bitcoin/bitcoin#32530: node: cap -maxmempool and -dbcache values for 32-bit
9f8e7b0b3b787b873045a4a8194e77d0b0a2b3b6 node: cap -dbcache to 1GiB on 32-bit architectures (Antoine Poinsot)
2c43b6adebbfabb3c8dd82fe821ce0a5d6173b3b init: cap -maxmempool to 500 MB on 32-bit systems (Antoine Poinsot)

Pull request description:

  32-bit architecture is limited to 4GiB of RAM, so it doesn't make sense to set a too high value. A too high value could cause an OOM unbeknownst to the user a while after startup as mempool / dbcache fills.

ACKs for top commit:
  achow101:
    ACK 9f8e7b0b3b787b873045a4a8194e77d0b0a2b3b6
  instagibbs:
    utACK 9f8e7b0b3b787b873045a4a8194e77d0b0a2b3b6
  dergoegge:
    Code review ACK 9f8e7b0b3b787b873045a4a8194e77d0b0a2b3b6
  glozow:
    utACK 9f8e7b0b3b787b873045a4a8194e77d0b0a2b3b6

Tree-SHA512: cc7541b2c0040fc21a43916caec464dfb443af808f4e85deffa1187448ffff6edb0d69f9ebdb43915d145b8b4694d8465afe548f88da53ccebc9ce4b7c34b735
2025-11-17 14:55:35 +00:00
Pablo Greco
e4990fe9ea
Merge pull request #1506 from psgreco/elem-23.3.1
Prepare 23.3.1
2025-11-17 01:35:17 -08:00
Pablo Greco
b46e2db705
Bump version to 23.3.1 2025-11-12 08:08:14 -08:00