Page MenuHomePhabricator

[tests] Add generate method to TestNode
ClosedPublic

Authored by deadalnix on May 5 2020, 23:49.

Details

Summary

Adds a generate() method to the TestNode class in the test framework.
This method intercepts calls to generate, imports a dewterministic
private key to the node and then calls generatetoaddress to generate the
block to that address.

Note that repeated calls to importprivkey for the same private keys are
no-ops, so it's fine to call the generate() method many times.

This is a partial backport of Core PR14468 : https://github.com/bitcoin/bitcoin/pull/14468/commits/aab81720de237b258ed4e15f1b1831c11abf74f0

The code was slightly tweaked because we have some tests for which self.rpc is None because they've been created after PR14631 which remove the call to importprivkey

Depends on D5969

Test Plan
ninja all check-all

Diff Detail

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

Event Timeline

[Bot Message]
One or more PR numbers were detected in the summary.
Links to those PRs have been inserted into the summary for reference.

This revision is now accepted and ready to land.May 6 2020, 08:27