Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-miner-fund.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2020 The Bitcoin developers | # Copyright (c) 2020 The Bitcoin developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
from test_framework.blocktools import (create_block, create_coinbase) | from test_framework.blocktools import ( | ||||
create_block, | |||||
create_coinbase, | |||||
TIME_GENESIS_BLOCK, | |||||
) | |||||
from test_framework.messages import ToHex | from test_framework.messages import ToHex | ||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import ( | from test_framework.util import ( | ||||
assert_equal, | assert_equal, | ||||
assert_greater_than_or_equal, | assert_greater_than_or_equal, | ||||
) | ) | ||||
from decimal import Decimal | from decimal import Decimal | ||||
PHONON_ACTIVATION_TIME = 1589544000 | PHONON_ACTIVATION_TIME = 1589544000 | ||||
VERSION_BASE = 536870912 | VERSION_BASE = 536870912 | ||||
MINER_FUND_RATIO = 20 | MINER_FUND_RATIO = 20 | ||||
MINER_FUND_ADDR = 'bchreg:pqv2r67sgz3qumufap3h2uuj0zfmnzuv8v7ej0fffv' | MINER_FUND_ADDR = 'bchreg:pqv2r67sgz3qumufap3h2uuj0zfmnzuv8v7ej0fffv' | ||||
MINER_FUND_ABC_ADDR = 'bchreg:qzvz0es48sf8wrqy7kn5j5cugka95ztskcra2r7ee7' | MINER_FUND_ABC_ADDR = 'bchreg:qzvz0es48sf8wrqy7kn5j5cugka95ztskcra2r7ee7' | ||||
MINER_FUND_BCHD_ADDR = 'bchreg:qrhea03074073ff3zv9whh0nggxc7k03ssffq2ylju' | MINER_FUND_BCHD_ADDR = 'bchreg:qrhea03074073ff3zv9whh0nggxc7k03ssffq2ylju' | ||||
MINER_FUND_ELECTRON_CASH_ADDR = 'bchreg:pp8d685l8kecnmtyy52ndvq625arz2qwmutyjlcyav' | MINER_FUND_ELECTRON_CASH_ADDR = 'bchreg:pp8d685l8kecnmtyy52ndvq625arz2qwmutyjlcyav' | ||||
class MinerFundTest(BitcoinTestFramework): | class MinerFundTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.setup_clean_chain = True | |||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
self.extra_args = [ | self.extra_args = [ | ||||
['-enableminerfund', "-phononactivationtime={}".format(PHONON_ACTIVATION_TIME)]] | ['-enableminerfund', "-phononactivationtime={}".format(PHONON_ACTIVATION_TIME)]] | ||||
def check_bip9_state(self, name, status): | def check_bip9_state(self, name, status): | ||||
miner_fund_info = self.nodes[0].getblockchaininfo()['softforks'][name] | miner_fund_info = self.nodes[0].getblockchaininfo()['softforks'][name] | ||||
assert_equal(miner_fund_info['bip9'], status) | assert_equal(miner_fund_info['bip9'], status) | ||||
def run_test(self): | def run_test(self): | ||||
node = self.nodes[0] | node = self.nodes[0] | ||||
address = node.get_deterministic_priv_key().address | address = node.get_deterministic_priv_key().address | ||||
self.log.info('Create some old blocks') | |||||
for t in range(TIME_GENESIS_BLOCK, | |||||
TIME_GENESIS_BLOCK + 200 * 600, 600): | |||||
# ten-minute steps from genesis block time | |||||
self.nodes[0].setmocktime(t) | |||||
self.nodes[0].generatetoaddress(1, address) | |||||
assert_equal(self.nodes[0].getblockchaininfo()['blocks'], 200) | |||||
# Get the vote started. | # Get the vote started. | ||||
node.setmocktime(1580000000) | node.setmocktime(1580000000) | ||||
def check_all_bip9_state(status): | def check_all_bip9_state(status): | ||||
self.check_bip9_state('minerfund', status) | self.check_bip9_state('minerfund', status) | ||||
self.check_bip9_state('minerfundabc', status) | self.check_bip9_state('minerfundabc', status) | ||||
self.check_bip9_state('minerfundbchd', status) | self.check_bip9_state('minerfundbchd', status) | ||||
self.check_bip9_state('minerfundelectroncash', status) | self.check_bip9_state('minerfundelectroncash', status) | ||||
▲ Show 20 Lines • Show All 148 Lines • Show Last 20 Lines |