-
Notifications
You must be signed in to change notification settings - Fork 38.7k
rpc: Remove mempool global from miner #17781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This fixes a typo in the test documentation
|
Strong concept ACK Also welcome from a fuzz testing perspective :) |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
Concept ACK |
|
Concept ACK, but this will make me sad from a rebasing perspective ;) |
|
Concept ACK. |
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK fa9c7398087b821ccebf522ee5184eca7fa81445.
fa9c739 to
faa92a2
Compare
|
Addressed feedback by @promag |
|
ACK faa92a2. |
|
ACK faa92a2 Reviewed code, tested locally. |
jnewbery
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK faa92a2
A couple of nits inline. Feel free to ignore.
|
|
||
| BlockAssembler::BlockAssembler(const CChainParams& params, const Options& options) : chainparams(params) | ||
| BlockAssembler::BlockAssembler(const CTxMemPool& mempool, const CChainParams& params, const Options& options) | ||
| : chainparams(params), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: order member initialization list the same as the parameter list (and preferably on one line)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer multiple lines
| throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Cannot derive script without private keys")); | ||
| } | ||
|
|
||
| const CTxMemPool& mempool = EnsureMemPool(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: place this either at the start of the function (so it exits early if there is no mempool), or immediately before the call to generateBlocks(). Placing it between the code that creates coinbase_script and the coinbase_script CHECK seems random.
Same comment for generatetoaddress()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might do in a follow-up to not invalidate the three reviews
faa92a2 rpc: Remove mempool global from miner (MarcoFalke) 6666ef1 test: Properly document blockinfo size in miner_tests (MarcoFalke) Pull request description: The miner needs read-only access to the mempool. Instead of using the mutable global `::mempool`, keep a immutable reference to a mempool that is passed to the miner. Apart from the obvious benefits of removing a global and making things immutable, this might also simplify testing with multiple mempools. ACKs for top commit: promag: ACK faa92a2. fjahr: ACK faa92a2 jnewbery: Code review ACK faa92a2 Tree-SHA512: c44027b5d2217a724791166f3f3112c45110ac1dbb37bdae27148a0657e0d1a1d043b0d24e49fd45465ec014224d1b7eb15c92a33069ad883fa8ffeadc24735b
faa92a2 rpc: Remove mempool global from miner (MarcoFalke) 6666ef1 test: Properly document blockinfo size in miner_tests (MarcoFalke) Pull request description: The miner needs read-only access to the mempool. Instead of using the mutable global `::mempool`, keep a immutable reference to a mempool that is passed to the miner. Apart from the obvious benefits of removing a global and making things immutable, this might also simplify testing with multiple mempools. ACKs for top commit: promag: ACK faa92a2. fjahr: ACK faa92a2 jnewbery: Code review ACK faa92a2 Tree-SHA512: c44027b5d2217a724791166f3f3112c45110ac1dbb37bdae27148a0657e0d1a1d043b0d24e49fd45465ec014224d1b7eb15c92a33069ad883fa8ffeadc24735b
0dae5a5 Fix benchmarks filters (Elichai Turkel) Pull request description: The bug was introduced in #17781 before this fix `./src/bench/bench_bitcoin -filter=*` will fail with: ``` # Benchmark, evals, iterations, total, min, max, median bench_bitcoin: bench/bench.cpp:119: static void benchmark::BenchRunner::RunAll(benchmark::Printer&, uint64_t, double, const string&, bool): Assertion `g_testing_setup == nullptr' failed. Aborted (core dumped) ``` ACKs for top commit: MarcoFalke: ACK 0dae5a5 Tree-SHA512: 43de4c7f4a5f29593972cf3bc822429466d0609c159c95d37c9e5370be392ace698b218a65542c7d53bfa52db7377ebdab808501ae109c2249f7f956bd318312
Summary: ``` The miner needs read-only access to the mempool. Instead of using the mutable global ::mempool, keep a immutable reference to a mempool that is passed to the miner. Apart from the obvious benefits of removing a global and making things immutable, this might also simplify testing with multiple mempools. ``` Backport of core [[bitcoin/bitcoin#17781 | PR17781]]. Depends on D7984. This differs quite a bit from the original PR because we already passed a mempool. This is mostly rename and factorization to make it looks more like core. Test Plan: ninja all check-all ninja bench-bitcoin With clang: ninja check Reviewers: #bitcoin_abc, jasonbcox Reviewed By: #bitcoin_abc, jasonbcox Subscribers: jasonbcox Differential Revision: https://reviews.bitcoinabc.org/D7988
faa92a2 rpc: Remove mempool global from miner (MarcoFalke) 6666ef1 test: Properly document blockinfo size in miner_tests (MarcoFalke) Pull request description: The miner needs read-only access to the mempool. Instead of using the mutable global `::mempool`, keep a immutable reference to a mempool that is passed to the miner. Apart from the obvious benefits of removing a global and making things immutable, this might also simplify testing with multiple mempools. ACKs for top commit: promag: ACK faa92a2. fjahr: ACK faa92a2 jnewbery: Code review ACK faa92a2 Tree-SHA512: c44027b5d2217a724791166f3f3112c45110ac1dbb37bdae27148a0657e0d1a1d043b0d24e49fd45465ec014224d1b7eb15c92a33069ad883fa8ffeadc24735b
Summary: > The bug was introduced in [[bitcoin/bitcoin#17781 | PR17781]] > before this fix `./src/bench/bitcoin-bench -filter="RIPEMD160|SHA256|SHA1"` will fail with: > ``` > # Benchmark, evals, iterations, total, min, max, median > bench_bitcoin: bench/bench.cpp:119: static void benchmark::BenchRunner::RunAll(benchmark::Printer&, uint64_t, double, const string&, bool): Assertion `g_testing_setup == nullptr' failed. > Aborted (core dumped) > ``` This is a backport of Core [[bitcoin/bitcoin#18013 | PR18013]] Test Plan: `ninja && ./src/bench/bitcoin-bench -filter="RIPEMD160|SHA256|SHA1"` Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D8690
The miner needs read-only access to the mempool. Instead of using the mutable global
::mempool, keep a immutable reference to a mempool that is passed to the miner. Apart from the obvious benefits of removing a global and making things immutable, this might also simplify testing with multiple mempools.