Page MenuHomePhabricator

[tests] Add generate method to TestNode

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



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 :

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

rABC Bitcoin ABC
Lint Not Applicable
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