Page MenuHomePhabricator

Add StateManager proof-of-concept to hold global state
AbandonedPublic

Authored by jasonbcox on Jun 25 2018, 23:33.

Details

Reviewers
deadalnix
schancel
Group Reviewers
Restricted Project
Summary

Globals are evil. That said, I built a proof-of-concept for StateManager
to show how the mempool can be properly managed as a non-global. Although the migration
for mempool code will be slow and arduous, I need something like this today in
order to appropriately build a BlockTemplateManager for the new API changes. The diff
for BlockTemplateManager will appear in the near future, so I'd like it's memory
management to be planned out in advance if possible.

Test Plan

make check (policyestimator_tests.cpp was used a guineapig)

Diff Detail

Repository
rABC Bitcoin ABC
Branch
state
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 2767
Build 3644: Bitcoin ABC Buildbot (legacy)
Build 3643: arc lint + arc unit

Event Timeline

src/bitcoind.cpp
78

This variable is currently unused, so I may remove it from this diff. But I did want to show where I intended to init the stateManager.

Despite the apparent ease-of-use this allows, it creates a dependency for every module that uses this class, which makes it very hard to migrate away from. Each stateful class should be init'd at the top level similar to how this class was intended, and then only passed to the modules where they are used.