Page MenuHomePhabricator

[refactor] add const CChainParams& m_params to interface::ChainImpl
ClosedPublic

Authored by majcosta on Jul 6 2020, 19:36.

Details

Summary

this diff adds a constant reference to CChainParams& for the interface::ChainImpl so we can get it from
global state there instead of all over the place

Test Plan
ninja all check-all
./src/bench/bitcoin-bench

cmake -GNinja .. -DENABLE_SANITIZERS="address;fuzzer" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
ninja bitcoin-fuzzers link-fuzz-test_runner.py
./test/fuzz/test_runner.py -l DEBUG <path_to_corpus>

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

majcosta requested review of this revision.Jul 6 2020, 19:36
majcosta edited the test plan for this revision. (Show Details)
majcosta edited the test plan for this revision. (Show Details)
deadalnix requested changes to this revision.Jul 6 2020, 20:00
deadalnix added a subscriber: deadalnix.

Good start, but you needlessly complicated yourself for the tests.

src/bench/wallet_balance.cpp
22 ↗(On Diff #22025)

Why not use the config object you already have?

src/bitcoind.cpp
189 ↗(On Diff #22025)

I suspect you wan to keep this where it was, unless you are looking for some fun debugging session figuring out why the NodeContext did not have a chain selected.

src/test/rpc_tests.cpp
141 ↗(On Diff #22025)

Why GetConfig ? That seems like an unnecessary step.

src/test/util/setup_common.h
98 ↗(On Diff #22025)

It seems to be out of scope.

src/wallet/test/coinselector_tests.cpp
38 ↗(On Diff #22025)

You can keep that guy.

305 ↗(On Diff #22025)

And create a chain on a per needed basis in the test. The fact there is only one test this way is a tell doing so at the framework level is not desirable.

This revision now requires changes to proceed.Jul 6 2020, 20:00
majcosta marked 6 inline comments as done.

addressed comments

src/test/rpc_tests.cpp
141 ↗(On Diff #22025)

I just didn't want to #include <chainparams.h> for Params() and chose to get that via GetConfig() instead. Is the latter method preferable?

141 ↗(On Diff #22025)

former**

deadalnix added inline comments.
src/bitcoind.cpp
124 ↗(On Diff #22028)

Keep

This revision is now accepted and ready to land.Jul 6 2020, 21:47