Use logging framework in Dash specific tests
This commit is contained in:
parent
0db2d1596a
commit
0e91ebcf42
@ -23,11 +23,11 @@ class AddressIndexTest(BitcoinTestFramework):
|
||||
def setup_network(self):
|
||||
self.nodes = []
|
||||
# Nodes 0/1 are "wallet" nodes
|
||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug", "-relaypriority=0"]))
|
||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-debug", "-addressindex"]))
|
||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-relaypriority=0"]))
|
||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-addressindex"]))
|
||||
# Nodes 2/3 are used for testing
|
||||
self.nodes.append(start_node(2, self.options.tmpdir, ["-debug", "-addressindex", "-relaypriority=0"]))
|
||||
self.nodes.append(start_node(3, self.options.tmpdir, ["-debug", "-addressindex"]))
|
||||
self.nodes.append(start_node(2, self.options.tmpdir, ["-addressindex", "-relaypriority=0"]))
|
||||
self.nodes.append(start_node(3, self.options.tmpdir, ["-addressindex"]))
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
connect_nodes(self.nodes[0], 2)
|
||||
connect_nodes(self.nodes[0], 3)
|
||||
@ -36,7 +36,7 @@ class AddressIndexTest(BitcoinTestFramework):
|
||||
self.sync_all()
|
||||
|
||||
def run_test(self):
|
||||
print("Mining blocks...")
|
||||
self.log.info("Mining blocks...")
|
||||
self.nodes[0].generate(105)
|
||||
self.sync_all()
|
||||
|
||||
@ -50,7 +50,7 @@ class AddressIndexTest(BitcoinTestFramework):
|
||||
assert_equal(balance0["balance"], 0)
|
||||
|
||||
# Check p2pkh and p2sh address indexes
|
||||
print("Testing p2pkh and p2sh address index...")
|
||||
self.log.info("Testing p2pkh and p2sh address index...")
|
||||
|
||||
txid0 = self.nodes[0].sendtoaddress("yMNJePdcKvXtWWQnFYHNeJ5u8TF2v1dfK4", 10)
|
||||
self.nodes[0].generate(1)
|
||||
@ -85,7 +85,7 @@ class AddressIndexTest(BitcoinTestFramework):
|
||||
assert_equal(txidsb[2], txidb2)
|
||||
|
||||
# Check that limiting by height works
|
||||
print("Testing querying txids by range of block heights..")
|
||||
self.log.info("Testing querying txids by range of block heights..")
|
||||
height_txids = self.nodes[1].getaddresstxids({
|
||||
"addresses": ["93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB"],
|
||||
"start": 105,
|
||||
@ -110,7 +110,7 @@ class AddressIndexTest(BitcoinTestFramework):
|
||||
assert_equal(balance0["balance"], 45 * 100000000)
|
||||
|
||||
# Check that outputs with the same address will only return one txid
|
||||
print("Testing for txid uniqueness...")
|
||||
self.log.info("Testing for txid uniqueness...")
|
||||
addressHash = binascii.unhexlify("FE30B718DCF0BF8A2A686BF1820C073F8B2C3B37")
|
||||
scriptPubKey = CScript([OP_HASH160, addressHash, OP_EQUAL])
|
||||
unspent = self.nodes[0].listunspent()
|
||||
@ -130,12 +130,12 @@ class AddressIndexTest(BitcoinTestFramework):
|
||||
assert_equal(txidsmany[3], sent_txid)
|
||||
|
||||
# Check that balances are correct
|
||||
print("Testing balances...")
|
||||
self.log.info("Testing balances...")
|
||||
balance0 = self.nodes[1].getaddressbalance("93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB")
|
||||
assert_equal(balance0["balance"], 45 * 100000000 + 21)
|
||||
|
||||
# Check that balances are correct after spending
|
||||
print("Testing balances after spending...")
|
||||
self.log.info("Testing balances after spending...")
|
||||
privkey2 = "cU4zhap7nPJAWeMFu4j6jLrfPmqakDAzy8zn8Fhb3oEevdm4e5Lc"
|
||||
address2 = "yeMpGzMj3rhtnz48XsfpB8itPHhHtgxLc3"
|
||||
addressHash2 = binascii.unhexlify("C5E4FB9171C22409809A3E8047A29C83886E325D")
|
||||
@ -188,13 +188,13 @@ class AddressIndexTest(BitcoinTestFramework):
|
||||
assert_equal(len(deltas), 1)
|
||||
|
||||
# Check that unspent outputs can be queried
|
||||
print("Testing utxos...")
|
||||
self.log.info("Testing utxos...")
|
||||
utxos = self.nodes[1].getaddressutxos({"addresses": [address2]})
|
||||
assert_equal(len(utxos), 1)
|
||||
assert_equal(utxos[0]["satoshis"], change_amount)
|
||||
|
||||
# Check that indexes will be updated with a reorg
|
||||
print("Testing reorg...")
|
||||
self.log.info("Testing reorg...")
|
||||
|
||||
best_hash = self.nodes[0].getbestblockhash()
|
||||
self.nodes[0].invalidateblock(best_hash)
|
||||
@ -229,7 +229,7 @@ class AddressIndexTest(BitcoinTestFramework):
|
||||
assert_equal(utxos3[2]["height"], 265)
|
||||
|
||||
# Check mempool indexing
|
||||
print("Testing mempool indexing...")
|
||||
self.log.info("Testing mempool indexing...")
|
||||
|
||||
privKey3 = "cRyrMvvqi1dmpiCmjmmATqjAwo6Wu7QTjKu1ABMYW5aFG4VXW99K"
|
||||
address3 = "yWB15aAdpeKuSaQHFVJpBDPbNSLZJSnDLA"
|
||||
@ -327,7 +327,7 @@ class AddressIndexTest(BitcoinTestFramework):
|
||||
mempool_deltas = self.nodes[2].getaddressmempool({"addresses": [address1]})
|
||||
assert_equal(len(mempool_deltas), 2)
|
||||
|
||||
print("Passed\n")
|
||||
self.log.info("Passed")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -32,7 +32,7 @@ class DIP3Test(BitcoinTestFramework):
|
||||
self.is_network_split = False
|
||||
|
||||
def start_controller_node(self, extra_args=None):
|
||||
print("starting controller node")
|
||||
self.log.info("starting controller node")
|
||||
if self.nodes is None:
|
||||
self.nodes = [None]
|
||||
args = self.extra_args
|
||||
@ -44,7 +44,7 @@ class DIP3Test(BitcoinTestFramework):
|
||||
connect_nodes_bi(self.nodes, 0, i)
|
||||
|
||||
def stop_controller_node(self):
|
||||
print("stopping controller node")
|
||||
self.log.info("stopping controller node")
|
||||
stop_node(self.nodes[0], 0)
|
||||
|
||||
def restart_controller_node(self):
|
||||
@ -52,19 +52,19 @@ class DIP3Test(BitcoinTestFramework):
|
||||
self.start_controller_node()
|
||||
|
||||
def run_test(self):
|
||||
print("funding controller node")
|
||||
self.log.info("funding controller node")
|
||||
while self.nodes[0].getbalance() < (self.num_initial_mn + 3) * 1000:
|
||||
self.nodes[0].generate(1) # generate enough for collaterals
|
||||
print("controller node has {} dash".format(self.nodes[0].getbalance()))
|
||||
self.log.info("controller node has {} dash".format(self.nodes[0].getbalance()))
|
||||
|
||||
# Make sure we're below block 135 (which activates dip3)
|
||||
print("testing rejection of ProTx before dip3 activation")
|
||||
self.log.info("testing rejection of ProTx before dip3 activation")
|
||||
assert(self.nodes[0].getblockchaininfo()['blocks'] < 135)
|
||||
|
||||
mns = []
|
||||
|
||||
# prepare mn which should still be accepted later when dip3 activates
|
||||
print("creating collateral for mn-before-dip3")
|
||||
self.log.info("creating collateral for mn-before-dip3")
|
||||
before_dip3_mn = self.prepare_mn(self.nodes[0], 1, 'mn-before-dip3')
|
||||
self.create_mn_collateral(self.nodes[0], before_dip3_mn)
|
||||
mns.append(before_dip3_mn)
|
||||
@ -73,11 +73,11 @@ class DIP3Test(BitcoinTestFramework):
|
||||
while self.nodes[0].getblockcount() < 150:
|
||||
self.nodes[0].generate(1)
|
||||
|
||||
print("mining final block for DIP3 activation")
|
||||
self.log.info("mining final block for DIP3 activation")
|
||||
self.nodes[0].generate(1)
|
||||
|
||||
# We have hundreds of blocks to sync here, give it more time
|
||||
print("syncing blocks for all nodes")
|
||||
self.log.info("syncing blocks for all nodes")
|
||||
sync_blocks(self.nodes, timeout=120)
|
||||
|
||||
# DIP3 has activated here
|
||||
@ -85,7 +85,7 @@ class DIP3Test(BitcoinTestFramework):
|
||||
self.register_mn(self.nodes[0], before_dip3_mn)
|
||||
self.start_mn(before_dip3_mn)
|
||||
|
||||
print("registering MNs")
|
||||
self.log.info("registering MNs")
|
||||
for i in range(0, self.num_initial_mn):
|
||||
mn = self.prepare_mn(self.nodes[0], i + 2, "mn-%d" % i)
|
||||
mns.append(mn)
|
||||
@ -98,12 +98,12 @@ class DIP3Test(BitcoinTestFramework):
|
||||
# let a few of the protx MNs refer to the existing collaterals
|
||||
fund = (i % 2) == 0
|
||||
if fund:
|
||||
print("register_fund %s" % mn.alias)
|
||||
self.log.info("register_fund %s" % mn.alias)
|
||||
self.register_fund_mn(self.nodes[0], mn)
|
||||
else:
|
||||
print("create_collateral %s" % mn.alias)
|
||||
self.log.info("create_collateral %s" % mn.alias)
|
||||
self.create_mn_collateral(self.nodes[0], mn)
|
||||
print("register %s" % mn.alias)
|
||||
self.log.info("register %s" % mn.alias)
|
||||
self.register_mn(self.nodes[0], mn)
|
||||
|
||||
self.nodes[0].generate(1)
|
||||
@ -114,10 +114,10 @@ class DIP3Test(BitcoinTestFramework):
|
||||
self.sync_all()
|
||||
self.assert_mnlists(mns)
|
||||
|
||||
print("testing instant send")
|
||||
self.log.info("testing instant send")
|
||||
self.test_instantsend(10, 3)
|
||||
|
||||
print("test that MNs disappear from the list when the ProTx collateral is spent")
|
||||
self.log.info("test that MNs disappear from the list when the ProTx collateral is spent")
|
||||
spend_mns_count = 3
|
||||
mns_tmp = [] + mns
|
||||
dummy_txins = []
|
||||
@ -129,30 +129,30 @@ class DIP3Test(BitcoinTestFramework):
|
||||
mns_tmp.remove(mns[i])
|
||||
self.assert_mnlists(mns_tmp)
|
||||
|
||||
print("test that reverting the blockchain on a single node results in the mnlist to be reverted as well")
|
||||
self.log.info("test that reverting the blockchain on a single node results in the mnlist to be reverted as well")
|
||||
for i in range(spend_mns_count):
|
||||
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
|
||||
mns_tmp.append(mns[spend_mns_count - 1 - i])
|
||||
self.assert_mnlist(self.nodes[0], mns_tmp)
|
||||
|
||||
print("cause a reorg with a double spend and check that mnlists are still correct on all nodes")
|
||||
self.log.info("cause a reorg with a double spend and check that mnlists are still correct on all nodes")
|
||||
self.mine_double_spend(self.nodes[0], dummy_txins, self.nodes[0].getnewaddress(), use_mnmerkleroot_from_tip=True)
|
||||
self.nodes[0].generate(spend_mns_count)
|
||||
self.sync_all()
|
||||
self.assert_mnlists(mns_tmp)
|
||||
|
||||
print("test mn payment enforcement with deterministic MNs")
|
||||
self.log.info("test mn payment enforcement with deterministic MNs")
|
||||
for i in range(20):
|
||||
node = self.nodes[i % len(self.nodes)]
|
||||
self.test_invalid_mn_payment(node)
|
||||
node.generate(1)
|
||||
self.sync_all()
|
||||
|
||||
print("testing ProUpServTx")
|
||||
self.log.info("testing ProUpServTx")
|
||||
for mn in mns:
|
||||
self.test_protx_update_service(mn)
|
||||
|
||||
print("testing P2SH/multisig for payee addresses")
|
||||
self.log.info("testing P2SH/multisig for payee addresses")
|
||||
multisig = self.nodes[0].createmultisig(1, [self.nodes[0].getnewaddress(), self.nodes[0].getnewaddress()])['address']
|
||||
self.update_mn_payee(mns[0], multisig)
|
||||
found_multisig_payee = False
|
||||
@ -171,7 +171,7 @@ class DIP3Test(BitcoinTestFramework):
|
||||
found_multisig_payee = True
|
||||
assert(found_multisig_payee)
|
||||
|
||||
print("testing reusing of collaterals for replaced MNs")
|
||||
self.log.info("testing reusing of collaterals for replaced MNs")
|
||||
for i in range(0, 5):
|
||||
mn = mns[i]
|
||||
# a few of these will actually refer to old ProRegTx internal collaterals,
|
||||
@ -186,15 +186,15 @@ class DIP3Test(BitcoinTestFramework):
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
self.assert_mnlists(mns)
|
||||
print("restarting MN %s" % new_mn.alias)
|
||||
self.log.info("restarting MN %s" % new_mn.alias)
|
||||
self.stop_node(new_mn.idx)
|
||||
self.start_mn(new_mn)
|
||||
self.sync_all()
|
||||
|
||||
print("testing instant send with replaced MNs")
|
||||
self.log.info("testing instant send with replaced MNs")
|
||||
self.test_instantsend(10, 3, timeout=20)
|
||||
|
||||
print("testing simple PoSe")
|
||||
self.log.info("testing simple PoSe")
|
||||
self.assert_mnlists(mns)
|
||||
self.nodes[0].spork('SPORK_17_QUORUM_DKG_ENABLED', 0)
|
||||
self.wait_for_sporks()
|
||||
@ -408,8 +408,8 @@ class DIP3Test(BitcoinTestFramework):
|
||||
expected = []
|
||||
for mn in mns:
|
||||
expected.append('%s-%d' % (mn.collateral_txid, mn.collateral_vout))
|
||||
print('mnlist: ' + str(node.masternode('list', 'status')))
|
||||
print('expected: ' + str(expected))
|
||||
self.log.error('mnlist: ' + str(node.masternode('list', 'status')))
|
||||
self.log.error('expected: ' + str(expected))
|
||||
raise AssertionError("mnlists does not match provided mns")
|
||||
|
||||
def wait_for_sporks(self, timeout=30):
|
||||
|
@ -26,7 +26,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
self.sync_all()
|
||||
|
||||
def run_test(self):
|
||||
print("Mining blocks...")
|
||||
self.log.info("Mining blocks...")
|
||||
|
||||
min_relay_tx_fee = self.nodes[0].getnetworkinfo()['relayfee']
|
||||
# This test is not meant to test fee estimation and we'd like
|
||||
|
@ -51,7 +51,7 @@ class MultiKeySporkTest(BitcoinTestFramework):
|
||||
# address(base58): yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui
|
||||
|
||||
self.nodes.append(start_node(0, self.options.tmpdir,
|
||||
["-debug", "-sporkkey=931wyuRNVYvhg18Uu9bky5Qg1z4QbxaJ7fefNBzjBPiLRqcd33F",
|
||||
["-sporkkey=931wyuRNVYvhg18Uu9bky5Qg1z4QbxaJ7fefNBzjBPiLRqcd33F",
|
||||
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
|
||||
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
|
||||
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
|
||||
@ -59,7 +59,7 @@ class MultiKeySporkTest(BitcoinTestFramework):
|
||||
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
|
||||
"-minsporkkeys=3"]))
|
||||
self.nodes.append(start_node(1, self.options.tmpdir,
|
||||
["-debug", "-sporkkey=91vbXGMSWKGHom62986XtL1q2mQDA12ngcuUNNe5NfMSj44j7g3",
|
||||
["-sporkkey=91vbXGMSWKGHom62986XtL1q2mQDA12ngcuUNNe5NfMSj44j7g3",
|
||||
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
|
||||
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
|
||||
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
|
||||
@ -67,7 +67,7 @@ class MultiKeySporkTest(BitcoinTestFramework):
|
||||
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
|
||||
"-minsporkkeys=3"]))
|
||||
self.nodes.append(start_node(2, self.options.tmpdir,
|
||||
["-debug", "-sporkkey=92bxUjPT5AhgXuXJwfGGXqhomY2SdQ55MYjXyx9DZNxCABCSsRH",
|
||||
["-sporkkey=92bxUjPT5AhgXuXJwfGGXqhomY2SdQ55MYjXyx9DZNxCABCSsRH",
|
||||
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
|
||||
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
|
||||
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
|
||||
@ -75,7 +75,7 @@ class MultiKeySporkTest(BitcoinTestFramework):
|
||||
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
|
||||
"-minsporkkeys=3"]))
|
||||
self.nodes.append(start_node(3, self.options.tmpdir,
|
||||
["-debug", "-sporkkey=934yPXiVGf4RCY2qTs2Bt5k3TEtAiAg12sMxCt8yVWbSU7p3fuD",
|
||||
["-sporkkey=934yPXiVGf4RCY2qTs2Bt5k3TEtAiAg12sMxCt8yVWbSU7p3fuD",
|
||||
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
|
||||
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
|
||||
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
|
||||
@ -83,7 +83,7 @@ class MultiKeySporkTest(BitcoinTestFramework):
|
||||
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
|
||||
"-minsporkkeys=3"]))
|
||||
self.nodes.append(start_node(4, self.options.tmpdir,
|
||||
["-debug", "-sporkkey=92Cxwia363Wg2qGF1fE5z4GKi8u7r1nrWQXdtsj2ACZqaDPSihD",
|
||||
["-sporkkey=92Cxwia363Wg2qGF1fE5z4GKi8u7r1nrWQXdtsj2ACZqaDPSihD",
|
||||
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
|
||||
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
|
||||
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
|
||||
|
@ -55,7 +55,7 @@ class InstantSendTest(DashTestFramework):
|
||||
# start last node
|
||||
self.nodes[self.isolated_idx] = start_node(self.isolated_idx,
|
||||
self.options.tmpdir,
|
||||
["-debug"] + self.extra_args)
|
||||
self.extra_args)
|
||||
# send doublespend transaction to isolated node
|
||||
self.nodes[self.isolated_idx].sendrawtransaction(dblspnd_tx['hex'])
|
||||
# generate block on isolated node with doublespend transaction
|
||||
|
@ -23,11 +23,11 @@ class SpentIndexTest(BitcoinTestFramework):
|
||||
def setup_network(self):
|
||||
self.nodes = []
|
||||
# Nodes 0/1 are "wallet" nodes
|
||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug"]))
|
||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-debug", "-spentindex"]))
|
||||
self.nodes.append(start_node(0, self.options.tmpdir))
|
||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-spentindex"]))
|
||||
# Nodes 2/3 are used for testing
|
||||
self.nodes.append(start_node(2, self.options.tmpdir, ["-debug", "-spentindex"]))
|
||||
self.nodes.append(start_node(3, self.options.tmpdir, ["-debug", "-spentindex", "-txindex"]))
|
||||
self.nodes.append(start_node(2, self.options.tmpdir, ["-spentindex"]))
|
||||
self.nodes.append(start_node(3, self.options.tmpdir, ["-spentindex", "-txindex"]))
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
connect_nodes(self.nodes[0], 2)
|
||||
connect_nodes(self.nodes[0], 3)
|
||||
@ -36,7 +36,7 @@ class SpentIndexTest(BitcoinTestFramework):
|
||||
self.sync_all()
|
||||
|
||||
def run_test(self):
|
||||
print("Mining blocks...")
|
||||
self.log.info("Mining blocks...")
|
||||
self.nodes[0].generate(105)
|
||||
self.sync_all()
|
||||
|
||||
@ -44,7 +44,7 @@ class SpentIndexTest(BitcoinTestFramework):
|
||||
assert_equal(chain_height, 105)
|
||||
|
||||
# Check that
|
||||
print("Testing spent index...")
|
||||
self.log.info("Testing spent index...")
|
||||
|
||||
privkey = "cU4zhap7nPJAWeMFu4j6jLrfPmqakDAzy8zn8Fhb3oEevdm4e5Lc"
|
||||
address = "yeMpGzMj3rhtnz48XsfpB8itPHhHtgxLc3"
|
||||
@ -62,7 +62,7 @@ class SpentIndexTest(BitcoinTestFramework):
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
print("Testing getspentinfo method...")
|
||||
self.log.info("Testing getspentinfo method...")
|
||||
|
||||
# Check that the spentinfo works standalone
|
||||
info = self.nodes[1].getspentinfo({"txid": unspent[0]["txid"], "index": unspent[0]["vout"]})
|
||||
@ -70,7 +70,7 @@ class SpentIndexTest(BitcoinTestFramework):
|
||||
assert_equal(info["index"], 0)
|
||||
assert_equal(info["height"], 106)
|
||||
|
||||
print("Testing getrawtransaction method...")
|
||||
self.log.info("Testing getrawtransaction method...")
|
||||
|
||||
# Check that verbose raw transaction includes spent info
|
||||
txVerbose = self.nodes[3].getrawtransaction(unspent[0]["txid"], 1)
|
||||
@ -112,7 +112,7 @@ class SpentIndexTest(BitcoinTestFramework):
|
||||
assert_equal(txVerbose4["vin"][0]["value"], Decimal(unspent[0]["amount"]))
|
||||
assert_equal(txVerbose4["vin"][0]["valueSat"], amount)
|
||||
|
||||
print("Passed\n")
|
||||
self.log.info("Passed")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -22,11 +22,9 @@ class SporkTest(BitcoinTestFramework):
|
||||
disable_mocktime()
|
||||
self.nodes = []
|
||||
self.nodes.append(start_node(0, self.options.tmpdir,
|
||||
["-debug", "-sporkkey=cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK"]))
|
||||
self.nodes.append(start_node(1, self.options.tmpdir,
|
||||
["-debug"]))
|
||||
self.nodes.append(start_node(2, self.options.tmpdir,
|
||||
["-debug"]))
|
||||
["-sporkkey=cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK"]))
|
||||
self.nodes.append(start_node(1, self.options.tmpdir))
|
||||
self.nodes.append(start_node(2, self.options.tmpdir))
|
||||
# connect only 2 first nodes at start
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
|
||||
@ -65,8 +63,8 @@ class SporkTest(BitcoinTestFramework):
|
||||
# restart nodes to check spork persistence
|
||||
stop_node(self.nodes[0], 0)
|
||||
stop_node(self.nodes[1], 1)
|
||||
self.nodes[0] = start_node(0, self.options.tmpdir, ["-debug"])
|
||||
self.nodes[1] = start_node(1, self.options.tmpdir, ["-debug"])
|
||||
self.nodes[0] = start_node(0, self.options.tmpdir)
|
||||
self.nodes[1] = start_node(1, self.options.tmpdir)
|
||||
assert(not self.get_test_spork_state(self.nodes[0]))
|
||||
assert(not self.get_test_spork_state(self.nodes[1]))
|
||||
|
||||
|
@ -178,8 +178,7 @@ class BitcoinTestFramework(object):
|
||||
stop_nodes(self.nodes)
|
||||
except BaseException as e:
|
||||
success = False
|
||||
print("Unexpected exception caught during shutdown: " + repr(e))
|
||||
traceback.print_tb(sys.exc_info()[2])
|
||||
self.log.exception("Unexpected exception caught during shutdown")
|
||||
else:
|
||||
self.log.info("Note: dashds were not stopped and may still be running")
|
||||
|
||||
|
@ -21,11 +21,11 @@ class TimestampIndexTest(BitcoinTestFramework):
|
||||
def setup_network(self):
|
||||
self.nodes = []
|
||||
# Nodes 0/1 are "wallet" nodes
|
||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug"]))
|
||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-debug", "-timestampindex"]))
|
||||
self.nodes.append(start_node(0, self.options.tmpdir))
|
||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-timestampindex"]))
|
||||
# Nodes 2/3 are used for testing
|
||||
self.nodes.append(start_node(2, self.options.tmpdir, ["-debug"]))
|
||||
self.nodes.append(start_node(3, self.options.tmpdir, ["-debug", "-timestampindex"]))
|
||||
self.nodes.append(start_node(2, self.options.tmpdir))
|
||||
self.nodes.append(start_node(3, self.options.tmpdir, ["-timestampindex"]))
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
connect_nodes(self.nodes[0], 2)
|
||||
connect_nodes(self.nodes[0], 3)
|
||||
@ -34,16 +34,16 @@ class TimestampIndexTest(BitcoinTestFramework):
|
||||
self.sync_all()
|
||||
|
||||
def run_test(self):
|
||||
print("Mining 5 blocks...")
|
||||
self.log.info("Mining 5 blocks...")
|
||||
blockhashes = self.nodes[0].generate(5)
|
||||
low = self.nodes[0].getblock(blockhashes[0])["time"]
|
||||
high = self.nodes[0].getblock(blockhashes[4])["time"]
|
||||
self.sync_all()
|
||||
print("Checking timestamp index...")
|
||||
self.log.info("Checking timestamp index...")
|
||||
hashes = self.nodes[1].getblockhashes(high, low)
|
||||
assert_equal(len(hashes), 5)
|
||||
assert_equal(sorted(blockhashes), sorted(hashes))
|
||||
print("Passed\n")
|
||||
self.log.info("Passed")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -23,11 +23,11 @@ class TxIndexTest(BitcoinTestFramework):
|
||||
def setup_network(self):
|
||||
self.nodes = []
|
||||
# Nodes 0/1 are "wallet" nodes
|
||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug"]))
|
||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-debug", "-txindex"]))
|
||||
self.nodes.append(start_node(0, self.options.tmpdir))
|
||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-txindex"]))
|
||||
# Nodes 2/3 are used for testing
|
||||
self.nodes.append(start_node(2, self.options.tmpdir, ["-debug", "-txindex"]))
|
||||
self.nodes.append(start_node(3, self.options.tmpdir, ["-debug", "-txindex"]))
|
||||
self.nodes.append(start_node(2, self.options.tmpdir, ["-txindex"]))
|
||||
self.nodes.append(start_node(3, self.options.tmpdir, ["-txindex"]))
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
connect_nodes(self.nodes[0], 2)
|
||||
connect_nodes(self.nodes[0], 3)
|
||||
@ -36,14 +36,14 @@ class TxIndexTest(BitcoinTestFramework):
|
||||
self.sync_all()
|
||||
|
||||
def run_test(self):
|
||||
print("Mining blocks...")
|
||||
self.log.info("Mining blocks...")
|
||||
self.nodes[0].generate(105)
|
||||
self.sync_all()
|
||||
|
||||
chain_height = self.nodes[1].getblockcount()
|
||||
assert_equal(chain_height, 105)
|
||||
|
||||
print("Testing transaction index...")
|
||||
self.log.info("Testing transaction index...")
|
||||
|
||||
privkey = "cU4zhap7nPJAWeMFu4j6jLrfPmqakDAzy8zn8Fhb3oEevdm4e5Lc"
|
||||
address = "yeMpGzMj3rhtnz48XsfpB8itPHhHtgxLc3"
|
||||
@ -66,7 +66,7 @@ class TxIndexTest(BitcoinTestFramework):
|
||||
assert_equal(verbose["vout"][0]["valueSat"], 5000000000);
|
||||
assert_equal(verbose["vout"][0]["value"], 50);
|
||||
|
||||
print("Passed\n")
|
||||
self.log.info("Passed")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user