Page MenuHomePhabricator

[electrum] don't hardcode coinbase amount in test_balance
ClosedPublic

Authored by PiRK on Nov 24 2023, 08:11.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCfe6fc6e235c5: [electrum] don't hardcode coinbase amount in test_balance
Summary

All the tests share the same blockchain, and we cannot control the order of the tests, so we cannot hardcode the expected coinbase output as the test may or may not run after a halving as occured.

Note that getblocktemplate cannot be used in this test framework, as we are stuck with a single node and this RPC fails if the node is not connected. So I reimplemented the equivalent of the node's GetBlockSubsidy function to compute the expected amount from the block height.

Test Plan

pytest electrumabc/tests/regtest

Diff Detail

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