Page MenuHomePhabricator

scripted-diff: test: Use existing chainman in unit tests
ClosedPublic

Authored by PiRK on Jun 21 2022, 08:44.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC7139c1b5fb04: scripted-diff: test: Use existing chainman in unit tests
Summary
-BEGIN VERIFY SCRIPT-
git ls-files -- src/test \
    | grep -v '^src/test/fuzz' \
    | xargs sed -i -E \
            -e 's@g_chainman\.m_blockman@m_node.chainman->m_blockman@g' \
            -e 's@([^:])(Chain(state|)Active)@\1::\2@g' \
            -e 's@::Chain(state|)Active\(\)@m_node.chainman->ActiveChain\1()@g' \
            -e 's@ActiveChain\(\)\.Tip\(\)->nHeight([^+-])@ActiveHeight()\1@g' \
            -e 's@ActiveChain\(\)\.Tip\(\)@ActiveTip()@g' \
            -e 's@ActiveChain\(\)\.Height\(\)@ActiveHeight()@g'
arc lint
-END VERIFY SCRIPT-

This is a backport of core#21866 [5/12]
https://github.com/bitcoin/bitcoin/pull/21866/commits/0d61634c066a7102d539e85e2b1a4ca15be9660a

Note: In addition to the change in the source material, this diff also uses of the ChainstaeManager::ActiveTip() and ChainstateManager::ActiveHeight()
shortcuts where applicable.

Depends on D11649 and D11650

Test Plan

ninja check

Event Timeline

PiRK requested review of this revision.Jun 21 2022, 08:44
Fabien requested changes to this revision.Jun 21 2022, 11:15
Fabien added a subscriber: Fabien.

Use ActiveHeight() and ActiveTip() where applicable

src/test/blockfilter_index_tests.cpp
177

ActiveTip()

285

Dito

src/test/coinstatsindex_tests.cpp
23

dito

src/test/finalization_tests.cpp
29

ActiveHeight()

This revision now requires changes to proceed.Jun 21 2022, 11:15
PiRK edited the summary of this revision. (Show Details)

use ActiveHeight() and ActiveTip() where applicable

Fabien requested changes to this revision.Jun 21 2022, 15:57
Fabien added inline comments.
src/test/miner_tests.cpp
309 ↗(On Diff #34077)

ActiveHeight()

314 ↗(On Diff #34077)

dito

431 ↗(On Diff #34077)

dito

This revision now requires changes to proceed.Jun 21 2022, 15:57
PiRK edited the summary of this revision. (Show Details)

's@ActiveChain\(\)\.Height\(\)@ActiveHeight()@g'

This revision is now accepted and ready to land.Jun 22 2022, 07:11