Commit graph

131 commits

Author SHA1 Message Date
ivanlele
e97627429b
Merge 601a6a6917 into merged_master (Bitcoin PR bitcoin/bitcoin#30965) 2026-04-14 11:55:06 +00:00
ivanlele
96b8f1c3c3
Merge 5837e3463f into merged_master (Bitcoin PR bitcoin/bitcoin#30967) 2026-03-30 10:15:21 +00:00
ivanlele
a2d81d7430
Merge be768dbd18 into merged_master (Bitcoin PR bitcoin/bitcoin#30618) 2026-03-25 16:55:11 +00:00
ivanlele
9deeff9661
Merge a5fa90706a into merged_master (Bitcoin PR bitcoin/bitcoin#30834) 2026-03-25 10:36:15 +00:00
ivanlele
c7d1ee1c41
Merge d184fc3ba4 into merged_master (Bitcoin PR bitcoin/bitcoin#30571) 2026-03-23 11:53:22 +00:00
ikripaka
f953ab649c
Merge 2c7a4231db into merged_master (Bitcoin PR bitcoin/bitcoin#30569) 2026-03-20 10:24:26 +00:00
ivanlele
c54dc2f736
Merge 1a19a4d960 into merged_master (Bitcoin PR bitcoin/bitcoin#29656) 2026-03-11 10:36:54 +00:00
Tom Trevethan
6de20f06c3 Merge ff827a8f46 into merged_master (Bitcoin PR bitcoin/bitcoin#30407) 2026-03-09 00:10:47 +00:00
ivanlele
cdfc5aad8d
Merge ddf2ebd465 into merged_master (Bitcoin PR bitcoin/bitcoin#30058) 2026-03-02 10:03:33 +00:00
ivanlele
362770315c
Merge 413844f1c2 into merged_master (Bitcoin PR bitcoin/bitcoin#29612) 2026-02-24 11:44:45 +00:00
ivanlele
b0960347f6
Merge b50554babd into merged_master (Bitcoin PR bitcoin/bitcoin#29370) 2026-02-16 16:28:40 +00:00
ivanlele
81a17ea31a Merge c07935bcf5 into merged_master (Bitcoin PR #28960) 2026-02-12 16:33:05 +00:00
Byron Hambly
cffb3d4646
Merge 38941045c5 into merged_master (Bitcoin PR bitcoin/bitcoin#29361) 2025-11-29 14:38:05 +02:00
Byron Hambly
b15f9acb3d
Merge 3c13f5d612 into merged_master (Bitcoin PR bitcoin/bitcoin#28956) 2025-11-29 14:05:38 +02:00
Byron Hambly
a41762b512
Merge 4ad5c71adb into merged_master (Bitcoin PR bitcoin/bitcoin#28051) 2025-11-17 16:50:25 +02:00
Byron Hambly
26b9abc2f2
Merge b5a271334c into merged_master (Bitcoin PR bitcoin/bitcoin#28922) 2025-11-11 08:56:23 +02:00
Byron Hambly
a162e5cc53
Merge 023418a140 into merged_master (Bitcoin PR bitcoin/bitcoin#28530) 2025-11-05 19:22:50 +02:00
Byron Hambly
7fc909ab98
Merge e7b0004b37 into merged_master (Bitcoin PR bitcoin/bitcoin#27596)
ELEMENTS TODO assumeutxo for liquidv1
2025-08-06 14:33:15 +02:00
Byron Hambly
4537155dea
Merge ac9fa6ec78 into merged_master (Bitcoin PR bitcoin/bitcoin#28385) 2025-08-04 12:54:30 +02:00
Byron Hambly
f95cdcb6d6 Merge 723f1c669f into merged_master (Bitcoin PR bitcoin/bitcoin#28218) 2025-07-04 21:40:54 +02:00
Byron Hambly
3e027c6bd4 Merge f4f1d6d230 into merged_master (Bitcoin PR bitcoin/bitcoin#27746) 2025-07-03 12:59:45 +02:00
Byron Hambly
d89934e8d0 Merge c464e67e0b into merged_master (Bitcoin PR bitcoin/bitcoin#28050) 2025-07-01 11:26:49 +02:00
Byron Hambly
a8a9ae2ae1 Merge 75135c673e into merged_master (Bitcoin PR bitcoin/bitcoin#27861) 2025-07-01 10:39:46 +02:00
Byron Hambly
22c2346a58 Merge 427853ab49 into merged_master (Bitcoin PR bitcoin/bitcoin#27876) 2025-06-27 14:40:16 +02:00
Byron Hambly
3af56ffbe7 Merge 153a6882f4 into merged_master (Bitcoin PR bitcoin/bitcoin#27576) 2025-06-27 13:00:41 +02:00
Byron Hambly
edc585d157 Merge 9564f98fee into merged_master (Bitcoin PR bitcoin/bitcoin#27636) 2025-06-25 11:40:46 +02:00
Byron Hambly
b1d470027d Merge c2f2abd0a4 into merged_master (Bitcoin PR bitcoin/bitcoin#27125) 2025-06-20 10:46:05 +02:00
Byron Hambly
e22e1b9509 Merge ccd4db7d62 into merged_master (Bitcoin PR bitcoin/bitcoin#27570) 2025-05-16 10:32:57 +02:00
Byron Hambly
192dfb449a Merge 86e7410b22 into merged_master (Bitcoin PR bitcoin/bitcoin#27348) 2025-04-11 22:51:29 +02:00
Byron Hambly
59a4dcb178 Merge cbfbf46e57 into merged_master (Bitcoin PR bitcoin/bitcoin#25781) 2025-04-10 09:10:09 +02:00
Tom Trevethan
d9ae059581 Merge d5e4f9a439 into merged_master (Bitcoin PR bitcoin/bitcoin#25740) 2025-04-09 18:53:55 +00:00
Byron Hambly
4ec18086ff Merge a245429d68 into merged_master (Bitcoin PR bitcoin/bitcoin#26940) 2025-04-07 10:05:17 +02:00
Byron Hambly
9d216df88a Merge 9321df4487 into merged_master (Bitcoin PR bitcoin/bitcoin#25862) 2025-04-07 09:44:14 +02:00
Tom Trevethan
7d07e14d44 Merge 6b7ccb98a5 into merged_master (Bitcoin PR bitcoin/bitcoin#26251) 2025-04-02 14:56:26 +00:00
Byron Hambly
b4405ba453 Merge e9262ea32a into merged_master (Bitcoin PR bitcoin/bitcoin#26750) 2025-03-31 16:37:52 +02:00
Byron Hambly
13c2a2b766
chainstatemanager: fix warnings of missing fields in initialization 2025-02-17 15:27:34 +02:00
Byron Hambly
ca0a68b350
Merge UP TO 551c8e9526 into merged_master (UP TO bitcoin/bitcoin#26349)
Includes FIXMEs for a few functional tests
2025-02-05 09:50:17 +02:00
TheCharlatan
7fbb1bc44b
kernel: Move block tree db open to block manager
This commit is done in preparation for the next commit. Here, the block
tree options are moved to the blockmanager options and the block tree is
instantiated through a helper method of the BlockManager, which is
removed again in the next commit.

Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
2025-01-20 21:19:39 +01:00
Ryan Ofsky
5ca28ef28b refactor: Split up NodeContext shutdown_signal and shutdown_request
Instead of having a single NodeContext::shutdown member that is used both to
request shutdowns and check if they have been requested, use separate members
for each. Benefits of this change:

1. Should make code a little clearer and easier to search because it is easier
   to see which parts of code are triggering shutdowns and which parts are just
   checking to see if they were triggered.

2. Makes it possible for init.cpp to specify additional code to run when a
   shutdown is requested, like signalling the m_tip_block_cv condition variable.

Motivation for this change was to remove hacky NodeContext argument and
m_tip_block_cv access from the StopRPC function, so StopRPC can just be
concerned with RPC functionality, not other node functionality.
2024-10-01 09:10:54 +02:00
Lőrinc
19947863e1 Use BOOST_CHECK_EQUAL for optional, arith_uint256, uint256, uint160
Example error before:
> unknown location:0: fatal error: in "validation_chainstatemanager_tests/chainstatemanager_args": std::bad_optional_access: bad_optional_access
test/validation_chainstatemanager_tests.cpp:781: last checkpoint

after:
> test/validation_chainstatemanager_tests.cpp:801: error: in "validation_chainstatemanager_tests/chainstatemanager_args": check set_opts({"-assumevalid=0"}).assumed_valid_block == uint256::ZERO has failed [std::nullopt != 0000000000000000000000000000000000000000000000000000000000000000]

Also added extra minimum_chainwork test to make it symmetric with assumevalid

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
Co-authored-by: Hodlinator <172445034+hodlinator@users.noreply.github.com>
2024-09-11 15:41:15 +02:00
MarcoFalke
fa9d7d5d20
test: Work around boost compilation error 2024-09-06 15:57:33 +02:00
merge-script
d184fc3ba4
Merge bitcoin/bitcoin#30571: test: [refactor] Use m_rng directly
948238a683 test: Remove FastRandomContext global (Ryan Ofsky)
fa0fe08eca scripted-diff: [test] Use g_rng/m_rng directly (MarcoFalke)
fa54cab473 test: refactor: Accept any RandomNumberGenerator in RandMoney (MarcoFalke)
68f77dd21e test: refactor: Pass rng parameters to test functions (Ryan Ofsky)
fa19af555d test: refactor: Move g_insecure_rand_ctx.Reseed out of the helper that calls MakeRandDeterministicDANGEROUS (MarcoFalke)
3dc527f460 test: refactor: Give unit test functions access to test state (Ryan Ofsky)
fab023e177 test: refactor: Make unsigned promotion explicit (MarcoFalke)
fa2cb654ec test: Add m_rng alias for the global random context (MarcoFalke)
fae7e3791c test: Correct the random seed log on a prevector test failure (MarcoFalke)

Pull request description:

  This is mostly a style-cleanup for the tests' random generation:

  1) `g_insecure_rand_ctx` in the tests is problematic, because the name is a leftover when the generator was indeed insecure. However, now the generator is *deterministic*, because the seed is either passed in or printed (c.f. RANDOM_CTX_SEED). Stating that deterministic randomness is insecure in the tests seems redundant at best. Fix it by just using `m_rng` for the name.

  2) The global random context has many one-line aliases, such as `InsecureRand32`. This is problematic, because the same line of code may use the context directly and through a wrapper at the same time. For example in net_tests (see below). This inconsistency is harmless, but confusing. Fix it by just removing the one-line aliases.

  ```
  src/test/net_tests.cpp:        auto msg_data_1 = g_insecure_rand_ctx.randbytes<uint8_t>(InsecureRandRange(100000));
  ````

  3) The wrapper for randmoney has the same problem that the same unit test uses the context directly and through a wrapper at the same time. Also, it has a single type of Rng hardcoded. Fix it by accepting any type.

ACKs for top commit:
  hodlinator:
    ACK 948238a683
  ryanofsky:
    Code review ACK 948238a683. Only changes since last review were changing a comments a little bit.
  marcofleon:
    Code review ACK 948238a683. Only changes since my last review are the improvements in `prevector_tests`.

Tree-SHA512: 69c6b46a42cb743138ee8c87ff26a588dbe083e3efb3dca49b8a133ba5d3b09e8bf01c590ec7e121a7d77cb1fd7dcacd927a9ca139ac65e1f7c6d1ec46f93b57
2024-08-28 16:56:32 +01:00
Ava Chow
2c7a4231db
Merge bitcoin/bitcoin#30569: node: reduce unsafe uint256S usage
18d65d2772 test: use uint256::FromUserHex for RANDOM_CTX_SEED (stickies-v)
6819e5a329 node: use uint256::FromUserHex for -assumevalid parsing (stickies-v)
2e58fdb544 util: remove unused IsHexNumber (stickies-v)
8a44d7d3c1 node: use uint256::FromUserHex for -minimumchainwork parsing (stickies-v)
70e2c87737 refactor: add uint256::FromUserHex helper (stickies-v)
85b7cbfcbe test: unittest chainstatemanager_args (stickies-v)

Pull request description:

  Since fad2991ba0, `uint256S` has been [deprecated](https://github.com/bitcoin/bitcoin/pull/30482/commits/fad2991ba073de0bd1f12e42bf0fbaca4a265508#diff-800776e2dda39116e889839f69409571a5d397de048a141da7e4003bc099e3e2R138) because it is less robust than the `base_blob::FromHex()` introduced in [the same PR](https://github.com/bitcoin/bitcoin/pull/30482). Specifically, it tries to recover from length-mismatches, recover from untrimmed whitespace, 0x-prefix and garbage at the end, instead of simply requiring exactly 64 hex-only characters. _(see also #30532)_

  This PR carves out the few `uint256S` callsites that may potentially prove a bit more controversial to change because they deal with user input and backwards incompatible behaviour change.

  The main behaviour change introduced in this PR is:
  - `-minimumchainwork` will raise an error when input is longer than 64 hex digits
  - `-assumevalid` will raise an error when input contains invalid hex characters, or when it is longer than 64 hex digits
  - test: the optional RANDOM_CTX_SEED env var will now cause tests to abort when it contains invalid hex characters, or when it is longer than 64 hex digits

  After this PR, the remaining work to remove `uint256S` completely is almost entirely mechanical and/or test related. I will open that PR once #30560 is merged because it builds on that.

ACKs for top commit:
  hodlinator:
    re-ACK 18d65d2772
  l0rinc:
    ACK 18d65d2772
  achow101:
    ACK 18d65d2772
  ryanofsky:
    Code review ACK 18d65d2772. Very nice change that cleans up the API, adds checking for invalid values, makes parsing of values more consistent, and adds test coverage.

Tree-SHA512: ec118ea3d56e1dfbc4c79acdbfc797f65c4d2107b0ca9577c848b4ab9b7cb8d05db9f3c7fe8441a09291aca41bf671572431f4eddc59be8fb53abbea76bbbf86
2024-08-27 16:47:54 -04:00
MarcoFalke
fa0fe08eca
scripted-diff: [test] Use g_rng/m_rng directly
-BEGIN VERIFY SCRIPT-

 # Use m_rng in unit test files
 ren() { sed -i "s:\<$1\>:$2:g" $( git grep -l "$1" src/test/*.cpp src/wallet/test/*.cpp src/test/util/setup_common.cpp ) ; }
 ren InsecureRand32                m_rng.rand32
 ren InsecureRand256               m_rng.rand256
 ren InsecureRandBits              m_rng.randbits
 ren InsecureRandRange             m_rng.randrange
 ren InsecureRandBool              m_rng.randbool
 ren g_insecure_rand_ctx           m_rng
 ren g_insecure_rand_ctx_temp_path g_rng_temp_path

-END VERIFY SCRIPT-
2024-08-26 11:19:52 +02:00
stickies-v
6819e5a329
node: use uint256::FromUserHex for -assumevalid parsing
Removes dependency on unsafe and deprecated uint256S.

This makes parsing more strict, by returning an error
when the input contains non-hex characters, or when it
contains more than 64 hex digits.

Also make feature_assumevalid.py more robust by using CBlock.hash
which is guaranteed to be 64 characters long, as opposed to the
variable-length hex(CBlock.sha256)
2024-08-23 13:53:40 +01:00
stickies-v
8a44d7d3c1
node: use uint256::FromUserHex for -minimumchainwork parsing
Removes dependency on unsafe and deprecated uint256S.

This makes parsing more strict, by returning an error
when the input contains more than 64 hex digits.
2024-08-23 13:53:40 +01:00
stickies-v
85b7cbfcbe
test: unittest chainstatemanager_args 2024-08-21 19:29:25 +01:00
Fabian Jahr
bf0efb4fc7
scripted-diff: Modernize naming of nChainTx and nTxCount
-BEGIN VERIFY SCRIPT-
sed -i 's/nChainTx/m_chain_tx_count/g' $(git grep -l 'nChainTx' ./src)
sed -i 's/nTxCount/tx_count/g' $(git grep -l 'nTxCount' ./src)
-END VERIFY SCRIPT-
2024-08-04 14:24:43 +02:00
MarcoFalke
fa690c8e53
test: [refactor] Pass TestOpts 2024-07-08 16:11:15 +02:00
stickies-v
260f8da71a
refactor: remove warnings globals 2024-06-13 11:20:49 +01:00