Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc_feature_minerfund.py
Show All 14 Lines | |||||
) | ) | ||||
from decimal import Decimal | from decimal import Decimal | ||||
AXION_ACTIVATION_TIME = 2000000600 | AXION_ACTIVATION_TIME = 2000000600 | ||||
MINER_FUND_RATIO = 8 | MINER_FUND_RATIO = 8 | ||||
LEGACY_MINER_FUND_ADDR = 'bchreg:pqnqv9lt7e5vjyp0w88zf2af0l92l8rxdgd35g0pkl' | |||||
MINER_FUND_ADDR = 'ecregtest:pqnqv9lt7e5vjyp0w88zf2af0l92l8rxdgz0wv9ltl' | MINER_FUND_ADDR = 'ecregtest:pqnqv9lt7e5vjyp0w88zf2af0l92l8rxdgz0wv9ltl' | ||||
class MinerFundTest(BitcoinTestFramework): | class MinerFundTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
self.extra_args = [[ | self.extra_args = [[ | ||||
'-enableminerfund', | '-enableminerfund', | ||||
'-axionactivationtime={}'.format(AXION_ACTIVATION_TIME), | '-axionactivationtime={}'.format(AXION_ACTIVATION_TIME), | ||||
]] | ]] | ||||
def test_validate_address_backwards_compatibility(self): | |||||
self.log.info( | |||||
"Testing CashAddr old prefix backward compatibility using the miner fund destination") | |||||
assert(self.nodes[0].validateaddress(MINER_FUND_ADDR)['isvalid']) | |||||
self.log.info("Address {} is valid".format(MINER_FUND_ADDR)) | |||||
assert(self.nodes[0].validateaddress( | |||||
LEGACY_MINER_FUND_ADDR)['isvalid']) | |||||
self.log.info("Address {} is valid".format(LEGACY_MINER_FUND_ADDR)) | |||||
minerFundScriptPubKey = self.nodes[0].validateaddress(MINER_FUND_ADDR)[ | |||||
'scriptPubKey'] | |||||
assert_equal(minerFundScriptPubKey, self.nodes[0].validateaddress( | |||||
LEGACY_MINER_FUND_ADDR)['scriptPubKey']) | |||||
self.log.info("Both addresses {} and {} share the {} scriptPubKey".format( | |||||
MINER_FUND_ADDR, LEGACY_MINER_FUND_ADDR, minerFundScriptPubKey)) | |||||
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 history') | self.log.info('Create some history') | ||||
for _ in range(0, 50): | for _ in range(0, 50): | ||||
node.generatetoaddress(1, address) | node.generatetoaddress(1, address) | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
block_height = node.getblockcount() + 1 | block_height = node.getblockcount() + 1 | ||||
block = create_block( | block = create_block( | ||||
fork_block_hash, create_coinbase(block_height), AXION_ACTIVATION_TIME + 1, version=4) | fork_block_hash, create_coinbase(block_height), AXION_ACTIVATION_TIME + 1, version=4) | ||||
block.solve() | block.solve() | ||||
assert_equal(node.submitblock(ToHex(block)), 'bad-cb-minerfund') | assert_equal(node.submitblock(ToHex(block)), 'bad-cb-minerfund') | ||||
self.test_validate_address_backwards_compatibility() | |||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
MinerFundTest().main() | MinerFundTest().main() |