Page MenuHomePhabricator

rpc: Remove mempool global from miner
ClosedPublic

Authored by Fabien on Oct 19 2020, 18:32.

Details

Reviewers
jasonbcox
Group Reviewers
Restricted Project
Commits
rABC97808ad06894: rpc: Remove mempool global from miner
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 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

Event Timeline

Fabien requested review of this revision.Oct 19 2020, 18:32
Fabien edited the summary of this revision. (Show Details)

Rebase

jasonbcox added a subscriber: jasonbcox.
jasonbcox added inline comments.
src/miner.h
169 ↗(On Diff #24795)

Nit: Make it match Core: _mempool -> mempool

This revision is now accepted and ready to land.Oct 19 2020, 23:36
src/miner.h
169 ↗(On Diff #24795)

Good catch, I did it for the cpp file but missed the header

Tail of the build log:

rpc_getchaintips.py                              | ✓ Passed  | 2 s
rpc_help.py                                      | ✓ Passed  | 1 s
rpc_invalidateblock.py                           | ✓ Passed  | 1 s
rpc_misc.py                                      | ✓ Passed  | 1 s
rpc_named_arguments.py                           | ✓ Passed  | 1 s
rpc_net.py                                       | ✓ Passed  | 1 s
rpc_preciousblock.py                             | ✓ Passed  | 1 s
rpc_psbt.py                                      | ✓ Passed  | 28 s
rpc_rawtransaction.py                            | ✓ Passed  | 45 s
rpc_scantxoutset.py                              | ✓ Passed  | 4 s
rpc_setban.py                                    | ✓ Passed  | 2 s
rpc_signmessage.py                               | ✓ Passed  | 1 s
rpc_signrawtransaction.py                        | ✓ Passed  | 1 s
rpc_txoutproof.py                                | ✓ Passed  | 2 s
rpc_uptime.py                                    | ✓ Passed  | 1 s
rpc_users.py                                     | ✓ Passed  | 4 s
rpc_whitelist.py                                 | ✓ Passed  | 1 s
tool_wallet.py                                   | ✓ Passed  | 3 s
wallet_abandonconflict.py                        | ✓ Passed  | 10 s
wallet_address_types.py                          | ✓ Passed  | 15 s
wallet_avoidreuse.py                             | ✓ Passed  | 6 s
wallet_backup.py                                 | ✓ Passed  | 46 s
wallet_balance.py                                | ✓ Passed  | 9 s
wallet_basic.py                                  | ✓ Passed  | 26 s
wallet_coinbase_category.py                      | ✓ Passed  | 1 s
wallet_create_tx.py                              | ✓ Passed  | 5 s
wallet_createwallet.py                           | ✓ Passed  | 2 s
wallet_createwallet.py --usecli                  | ✓ Passed  | 2 s
wallet_disable.py                                | ✓ Passed  | 1 s
wallet_dump.py                                   | ✓ Passed  | 2 s
wallet_encryption.py                             | ✓ Passed  | 6 s
wallet_groups.py                                 | ✓ Passed  | 44 s
wallet_hd.py                                     | ✓ Passed  | 6 s
wallet_import_rescan.py                          | ✓ Passed  | 5 s
wallet_import_with_label.py                      | ✓ Passed  | 1 s
wallet_importmulti.py                            | ✓ Passed  | 3 s
wallet_importprunedfunds.py                      | ✓ Passed  | 2 s
wallet_keypool.py                                | ✓ Passed  | 3 s
wallet_keypool_topup.py                          | ✓ Passed  | 2 s
wallet_labels.py                                 | ✓ Passed  | 1 s
wallet_listreceivedby.py                         | ✓ Passed  | 8 s
wallet_listsinceblock.py                         | ✓ Passed  | 2 s
wallet_listtransactions.py                       | ✓ Passed  | 14 s
wallet_multiwallet.py                            | ✓ Passed  | 14 s
wallet_multiwallet.py --usecli                   | ✓ Passed  | 15 s
wallet_reorgsrestore.py                          | ✓ Passed  | 3 s
wallet_resendwallettransactions.py               | ✓ Passed  | 11 s
wallet_txn_clone.py                              | ✓ Passed  | 2 s
wallet_txn_clone.py --mineblock                  | ✓ Passed  | 3 s
wallet_txn_doublespend.py                        | ✓ Passed  | 1 s
wallet_txn_doublespend.py --mineblock            | ✓ Passed  | 3 s
wallet_watchonly.py                              | ✓ Passed  | 1 s
wallet_watchonly.py --usecli                     | ✓ Passed  | 1 s
wallet_zapwallettxes.py                          | ✓ Passed  | 4 s

ALL                                              | ✓ Passed  | 766 s (accumulated) 
Runtime: 154 s

ninja: build stopped: cannot make progress due to previous errors.
Build build-diff failed with exit code 1
This revision was landed with ongoing or failed builds.Oct 20 2020, 06:33
This revision was automatically updated to reflect the committed changes.