Commit graph

101 commits

Author SHA1 Message Date
ivanlele
05f1981454
Merge 992f37f2e1 into merged_master (Bitcoin PR bitcoin/bitcoin#31600) 2026-04-14 11:02:16 +00:00
Tom Trevethan
499eb0cb03 Merge 59876b3ad7 into merged_master (Bitcoin PR bitcoin/bitcoin#31376) 2026-04-14 01:17:12 +01:00
ivanlele
6bb16229de
Merge 66aa6a47bd into merged_master (Bitcoin PR bitcoin/bitcoin#30391) 2026-04-09 15:17:56 +00:00
ivanlele
33f3d54f21
Merge cd3d9fa5ea into merged_master (Bitcoin PR bitcoin/bitcoin#31318) 2026-04-09 09:23:15 +00:00
ivanlele
1d6999fc92
Merge 1a8f51e745 into merged_master (Bitcoin PR bitcoin/bitcoin#28843) 2026-04-03 12:26:37 +00:00
ivanlele
0a8be8f942
Merge 3f66642820 into merged_master (Bitcoin PR bitcoin/bitcoin#30440) 2026-03-26 10:43:00 +00:00
ivanlele
a51624f2ed
Merge d4cc0c6845 into merged_master (Bitcoin PR bitcoin/bitcoin#30750) 2026-03-24 11:43:55 +00:00
Tom Trevethan
f60016e6ad Merge 338b9d82dc into merged_master (Bitcoin PR bitcoin/bitcoin#30681) 2026-03-13 13:51:41 +00:00
ivanlele
9cfa8d130d
Merge ef19a193fc into merged_master (Bitcoin PR bitcoin/bitcoin#30356) 2026-03-09 14:55:47 +00:00
ivanlele
d487f1e562
Merge be63674c18 into merged_master (Bitcoin PR bitcoin/bitcoin#30324) 2026-03-03 13:59:54 +00:00
ikripaka
7f7a7c4e0c
Merge 323b0acfcb into merged_master (Bitcoin PR bitcoin/bitcoin#30200) 2026-03-02 15:10:06 +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
d46449ab86
Merge 950af7c876 into merged_master (Bitcoin PR bitcoin/bitcoin#28878) 2025-11-10 14:35:23 +02:00
Byron Hambly
d55f2b27cb
Merge dd5f5713bc into merged_master (Bitcoin PR bitcoin/bitcoin#28391) 2025-11-06 11:13:40 +02:00
Byron Hambly
5ee80641fe Merge b565485c24 into merged_master (Bitcoin PR bitcoin/bitcoin#28186) 2025-07-03 20:58:01 +02:00
Byron Hambly
5ac82e15a9 Merge 669af32632 into merged_master (Bitcoin PR bitcoin/bitcoin#27419) 2025-05-09 11:47:45 +02:00
Byron Hambly
61dada4d59 Merge 08b65df1bb into merged_master (Bitcoin PR bitcoin/bitcoin#26883) 2025-04-07 10:22:15 +02:00
Byron Hambly
bb18aed1c1 Merge 2f6a8e5e02 into merged_master (Bitcoin PR bitcoin/bitcoin#26695) 2025-04-01 21:37:29 +02:00
Byron Hambly
80b3fcae86 Merge 80fc1af096 into merged_master (Bitcoin PR bitcoin/bitcoin#26289) 2025-04-01 09:10:14 +02:00
Byron Hambly
b4405ba453 Merge e9262ea32a into merged_master (Bitcoin PR bitcoin/bitcoin#26750) 2025-03-31 16:37:52 +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
Sjors Provoost
0713548137
refactor: add GetMinimumTime() helper
Before bip94 there was an assumption that the minimum permitted
timestamp is GetMedianTimePast() + 1.

This commit splits a helper function out of UpdateTime() to
obtain the minimum time in a way that takes the
timewarp attack rule into account.
2025-01-29 09:39:32 +01:00
merge-script
59876b3ad7
Merge bitcoin/bitcoin#31376: Miner: never create a template which exploits the timewarp bug
733fa0b0a1 miner: never create a template which exploits the timewarp bug (Antoine Poinsot)

Pull request description:

  This check was introduced in #30681 but only enabled for testnet4. To avoid potentially creating an invalid block template if a soft fork to fix the timewarp attack were to activate in the future, we should have this check on all networks. It also seems wise for our miner to not support it whether or not a soft fork activates to fix it at the consensus level.

ACKs for top commit:
  Sjors:
    ACK 733fa0b0a1
  fjahr:
    utACK 733fa0b0a1
  TheCharlatan:
    ACK 733fa0b0a1

Tree-SHA512: 9b3bc8b26a57f93425b17dda80bcfac4ecb750a3d26bc3eb8df619135634e369ac15982fac0c9770b1df207bd2e418ffe02a98f37968f024e55262d97715a4f5
2025-01-23 10:54:47 +00:00
ismaelsadeeq
7c123c08dd
miner: add package feerate vector to CBlockTemplate
- The package feerates are ordered by the sequence in which
  packages are selected for inclusion in the block template.

- The commit also tests this new behaviour.

Co-authored-by: willcl-ark <will@256k1.dev>
2025-01-07 15:29:17 -05:00
Byron Hambly
a6f8dc6a86
tidy: fixes for clang tidy ci job 2024-12-04 14:16:45 +02:00
Sjors Provoost
ff41b9e296
Drop script_pub_key arg from createNewBlock
Providing a script for the coinbase transaction is only done in test code
and for CPU solo mining.

Production miners use the getblocktemplate RPC which omits the coinbase
transaction entirely from its block template, leaving it to external (pool)
software to construct it.

A coinbase script can still be passed via BlockCreateOptions instead.

A temporary overload is added so that the test can be modified in the
next commit.
2024-12-04 12:44:57 +07:00
Byron Hambly
8499b13762
lint: fix lint issues 2024-12-03 14:02:33 +02:00
Antoine Poinsot
733fa0b0a1 miner: never create a template which exploits the timewarp bug 2024-11-26 12:48:29 -05:00
Byron Hambly
b80b3aeff4 Merge 3a7e0a210c into merged_master (Bitcoin PR bitcoin/bitcoin#24513) 2024-11-26 14:42:49 +02:00
Ava Chow
1a8f51e745
Merge bitcoin/bitcoin#28843: [refactor] Cleanup BlockAssembler mempool usage
192dac1d33 [refactor] Cleanup BlockAssembler mempool usage (TheCharlatan)

Pull request description:

  The `addPackageTxs` method of the `BlockAssembler` currently has access to two mempool variables, as an argument and as a member. Clean this up and clarify that they both are the same mempool instance by removing the argument and instead only using the member variable in the method.

  This was noticed in this PR review: https://github.com/bitcoin/bitcoin/pull/25223#discussion_r898164322.

ACKs for top commit:
  achow101:
    ACK 192dac1d33
  danielabrozzoni:
    re-ACK 192dac1
  stickies-v:
    ACK 192dac1d33

Tree-SHA512: a5ae7d6d771fbb5b54f23624b4d3429acf07bbe38179a462a078c825d60c89a725ad4e13fe7067eebea7dfec63c56c8f39b5077b0d949d594f500affcc1272d1
2024-11-14 16:30:48 -05:00
Byron Hambly
3fd262a515 Merge 0f35f4ddf4 into merged_master (Bitcoin PR bitcoin/bitcoin#25786) 2024-11-04 12:32:04 +02:00
TheCharlatan
192dac1d33
[refactor] Cleanup BlockAssembler mempool usage
The `addPackageTxs` method of the `BlockAssembler` currently has access
to two mempool variables, as an argument and as a member. Clean this up
and clarify that they both are the same mempool instance by removing the
argument and instead only using the member variable in the method.

Co-Authored-By: Anthony Towns <aj@erisian.com.au>
Co-authored-by: stickies-v <stickies-v@protonmail.com>
2024-10-21 15:55:35 +02:00
James Dorfman
05090af6ca Merge 639715df61 into merged_master (Elements PR #1356) 2024-10-08 05:49:33 +00:00
Sjors Provoost
a93c171faa
Drop unneeded nullptr check from CreateNewBlock() 2024-09-13 10:14:53 +02:00
James Dorfman
616633ec35 Merge a7a36590f5 into merged_master (Bitcoin PR bitcoin/bitcoin#25223) 2024-09-10 19:59:14 +00:00
James Dorfman
89feb0ed3b Merge 57bf12523c into merged_master (Bitcoin PR bitcoin/bitcoin#24934) 2024-09-06 16:21:00 +00:00
MarcoFalke
3333415890
scripted-diff: LogPrint -> LogDebug
-BEGIN VERIFY SCRIPT-
 sed -i 's/\<LogPrint\>/LogDebug/g' $( git grep -l '\<LogPrint\>'  -- ./contrib/ ./src/ ./test/ ':(exclude)src/logging.h' )
-END VERIFY SCRIPT-
2024-08-29 13:49:57 +02:00
Sjors Provoost
59ff17e5af
miner: adjust clock to timewarp rule 2024-08-20 18:51:37 +02:00
Byron Hambly
b0d6cde2d0
fix: use discountvsize in miner if discount enabled 2024-08-16 12:35:04 +02:00
James Dorfman
bfb0f5d1e1 Merge 640eb772e5 into merged_master (Bitcoin PR bitcoin/bitcoin#25064) 2024-08-13 21:57:29 +00:00
James Dorfman
66bc45020f Merge 4d0c00dffd into merged_master (Bitcoin PR bitcoin/bitcoin#25168) 2024-08-13 20:10:21 +00:00
James Dorfman
5854eae590 Merge 25dd4d8513 into merged_master (Bitcoin PR bitcoin/bitcoin#24595) 2024-08-12 02:29:42 +00:00
James Dorfman
1278b31bc7 Merge 372f1a3c25 into merged_master (Bitcoin PR bitcoin/bitcoin#24753)
Please review this very very carefully. I don't think this is correct, but I wanted to move on with the merges.
Let's fix this.
2024-07-26 06:16:39 +00:00
Sjors Provoost
c504b6997b
refactor: add coinbase constraints to BlockCreateOptions
When generating a block template through e.g. getblocktemplate RPC,
we reserve 4000 weight units and 400 sigops. Pools use this space
for their coinbase outputs.

At least one pool patched their Bitcoin Core node to adjust
these hardcoded values. They eventually produced an invalid
block which exceeded the sigops limit.
https://bitcoin.stackexchange.com/questions/117837/how-many-sigops-are-in-the-invalid-block-783426

The existince of such patches suggests it may be useful to
make this value configurable. This commit would make such a
change easier.

The main motivation however is that the Stratum v2 spec
requires the pool to communicate the maximum bytes they intend
to add to the coinbase outputs. A proposed change to the spec
would also require them to communicate the maximum number of sigops.

This commit also documents what happens when
-blockmaxweight is lower than the coinbase
reserved value.

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
2024-07-17 18:33:15 +02:00
Sjors Provoost
6b4c817d4b
refactor: pass BlockCreateOptions to createNewBlock
Rather than pass options individually to createNewBlock and then
combining them into BlockAssembler::Options, this commit introduces
BlockCreateOptions and passes that instead.

Currently there's only one option (use_mempool) but the next
commit adds more.

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
2024-07-16 10:27:57 +02:00
Lőrinc
323ce30308 Moved the repeated -printpriority fetching out of AddToBlock
AddToBlock was called repeatedly from `addPackageTxs` where the constant value of `printpriority` is recalculated every time.
Since its behavior was changed in 400b151, I've named the variable accordingly.

This showed up during profiling of AssembleBlock, fetching it once in the constructor results in a measurable speed increase for many iterations.

> ./src/bench/bench_bitcoin --filter='AssembleBlock' --min-time=1000

before:
|               ns/op |                op/s |    err% |     total | benchmark
|--------------------:|--------------------:|--------:|----------:|:----------
|          155,558.97 |            6,428.43 |    0.1% |      1.10 | `AssembleBlock`

after:
|               ns/op |                op/s |    err% |     total | benchmark
|--------------------:|--------------------:|--------:|----------:|:----------
|          148,083.68 |            6,752.94 |    0.1% |      1.10 | `AssembleBlock`

Co-authored-by: furszy <mfurszy@protonmail.com>
2024-06-30 23:00:13 +02:00
Sjors Provoost
64ebb0f971
Always pass options to BlockAssembler constructor
This makes the options argument for BlockAssembler constructor mandatory,
dropping implicit use of ArgsManager. The caller i.e. the Mining
interface implementation now handles this.

In a future Stratum v2 change the Options object needs to be
mofified after arguments have been processed. Specifically
the pool communicates how many extra bytes it needs for
its own outputs (payouts, extra commitments, etc). This will need
to be substracted from what the user set as -blockmaxweight.

Such a change can be implemented in createNewBlock, after
ApplyArgsManOptions.
2024-06-18 18:47:51 +02:00
James Dorfman
9c1d4cc8ff Merge a4d7ac7bbe into merged_master (Elements PR #1317) 2024-05-24 16:13:46 +00:00
Byron Hambly
4807f3ef1f
discount: change miner tx ordering 2024-05-14 19:03:37 +02:00