HomePhabricator

[electrum] don't hardcode coinbase amount in test_balance

Description

[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

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
PiRKAuthored on Nov 24 2023, 08:00
PiRKPushed on Nov 24 2023, 10:06
Reviewer
Restricted Project
Differential Revision
D14846: [electrum] don't hardcode coinbase amount in test_balance
Parents
rABCa3e9a3ff663b: Cleanup the Nov. 15 2023 activation code and prepare for the May 15 2024 upgrade
Branches
Unknown
Tags
Unknown