Update to py3 conventions, update decimal calls to be consistent
This commit is contained in:
parent
6644c70c64
commit
4fb6d38c38
|
@ -1,10 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (c) 2019 The Zcash developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://www.opensource.org/licenses/mit-license.php .
|
||||
|
||||
import sys; assert sys.version_info < (3,), ur"This script does not run under Python 3. Please use Python 2.7.x."
|
||||
|
||||
from decimal import Decimal
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import (
|
||||
|
@ -27,7 +25,7 @@ class ShorterBlockTimes(BitcoinTestFramework):
|
|||
initialize_chain_clean(self.options.tmpdir, 4)
|
||||
|
||||
def run_test(self):
|
||||
print "Mining blocks..."
|
||||
print("Mining blocks...")
|
||||
self.nodes[0].generate(101)
|
||||
self.sync_all()
|
||||
|
||||
|
@ -36,8 +34,8 @@ class ShorterBlockTimes(BitcoinTestFramework):
|
|||
|
||||
node0_taddr = get_coinbase_address(self.nodes[0])
|
||||
node0_zaddr = self.nodes[0].z_getnewaddress('sapling')
|
||||
recipients = [{'address': node0_zaddr, 'amount': Decimal('10')}]
|
||||
myopid = self.nodes[0].z_sendmany(node0_taddr, recipients, 1, Decimal('0'))
|
||||
recipients = [{'address': node0_zaddr, 'amount': Decimal("10.0")}]
|
||||
myopid = self.nodes[0].z_sendmany(node0_taddr, recipients, 1, Decimal("0.0"))
|
||||
txid = wait_and_assert_operationid_status(self.nodes[0], myopid)
|
||||
assert_equal(105, self.nodes[0].getrawtransaction(txid, 1)['expiryheight']) # Blossom activation - 1
|
||||
self.sync_all()
|
||||
|
@ -47,7 +45,7 @@ class ShorterBlockTimes(BitcoinTestFramework):
|
|||
|
||||
self.nodes[0].generate(2)
|
||||
self.sync_all()
|
||||
print "Mining last pre-Blossom blocks"
|
||||
print("Mining last pre-Blossom blocks")
|
||||
# Activate blossom
|
||||
self.nodes[1].generate(1)
|
||||
self.sync_all()
|
||||
|
@ -55,14 +53,14 @@ class ShorterBlockTimes(BitcoinTestFramework):
|
|||
assert_equal(10, Decimal(self.nodes[1].getwalletinfo()['immature_balance']))
|
||||
|
||||
# After blossom activation the block reward will be halved
|
||||
print "Mining first Blossom block"
|
||||
print("Mining first Blossom block")
|
||||
self.nodes[1].generate(1)
|
||||
self.sync_all()
|
||||
# Check that we received an additional Blossom mining reward
|
||||
assert_equal(15, self.nodes[1].getwalletinfo()['immature_balance'])
|
||||
|
||||
# Send and mine a transaction after activation
|
||||
myopid = self.nodes[0].z_sendmany(node0_taddr, recipients, 1, Decimal('0'))
|
||||
myopid = self.nodes[0].z_sendmany(node0_taddr, recipients, 1, Decimal('0.0'))
|
||||
txid = wait_and_assert_operationid_status(self.nodes[0], myopid)
|
||||
assert_equal(147, self.nodes[0].getrawtransaction(txid, 1)['expiryheight']) # height + 1 + 40
|
||||
self.nodes[1].generate(1)
|
||||
|
|
Loading…
Reference in New Issue