HomePhabricator

Move SetMTP into test utils

Description

Move SetMTP into test utils

Summary:
SetMTP is useful for testing any function that takes a block index and does its own activation checks.

It is possible to set MTP in unit tests with a naive implementation like:

for (auto &block : blocks) {
    block.nTime = target_mtp;
}

This works but has the possibly unintended effect of not testing activation boundaries reliably. We should encourage the use of SetMTP over the naive implementation. The first step to doing so is moving it into test utils.

Test Plan:

ninja check

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Subscribers: PiRK

Differential Revision: https://reviews.bitcoinabc.org/D13077

Details

Provenance
sdulfariAuthored on Jan 30 2023, 21:24
sdulfariPushed on Jan 31 2023, 21:57
Reviewer
Restricted Project
Differential Revision
D13077: Move SetMTP into test utils
Parents
rABC72f9c0d3b798: [Explorer] Fix css rule for token table padding
Branches
Unknown
Tags
Unknown