Use logging in individual tests

This commit is contained in:
John Newbery
2017-03-07 18:46:17 -05:00
parent 38ad281b2a
commit 64c080051b
33 changed files with 212 additions and 224 deletions

View File

@@ -25,19 +25,15 @@ def make_utxo(node, amount, confirmed=True, scriptPubKey=CScript([1])):
fee = 1*COIN
while node.getbalance() < satoshi_round((amount + fee)/COIN):
node.generate(100)
#print (node.getbalance(), amount, fee)
new_addr = node.getnewaddress()
#print new_addr
txid = node.sendtoaddress(new_addr, satoshi_round((amount+fee)/COIN))
tx1 = node.getrawtransaction(txid, 1)
txid = int(txid, 16)
i = None
for i, txout in enumerate(tx1['vout']):
#print i, txout['scriptPubKey']['addresses']
if txout['scriptPubKey']['addresses'] == [new_addr]:
#print i
break
assert i is not None
@@ -84,34 +80,34 @@ class ReplaceByFeeTest(BitcoinTestFramework):
def run_test(self):
make_utxo(self.nodes[0], 1*COIN)
print("Running test simple doublespend...")
self.log.info("Running test simple doublespend...")
self.test_simple_doublespend()
print("Running test doublespend chain...")
self.log.info("Running test doublespend chain...")
self.test_doublespend_chain()
print("Running test doublespend tree...")
self.log.info("Running test doublespend tree...")
self.test_doublespend_tree()
print("Running test replacement feeperkb...")
self.log.info("Running test replacement feeperkb...")
self.test_replacement_feeperkb()
print("Running test spends of conflicting outputs...")
self.log.info("Running test spends of conflicting outputs...")
self.test_spends_of_conflicting_outputs()
print("Running test new unconfirmed inputs...")
self.log.info("Running test new unconfirmed inputs...")
self.test_new_unconfirmed_inputs()
print("Running test too many replacements...")
self.log.info("Running test too many replacements...")
self.test_too_many_replacements()
print("Running test opt-in...")
self.log.info("Running test opt-in...")
self.test_opt_in()
print("Running test prioritised transactions...")
self.log.info("Running test prioritised transactions...")
self.test_prioritised_transactions()
print("Passed\n")
self.log.info("Passed")
def test_simple_doublespend(self):
"""Simple doublespend"""
@@ -460,7 +456,7 @@ class ReplaceByFeeTest(BitcoinTestFramework):
except JSONRPCException as exp:
assert_equal(exp.error['code'], -26)
else:
print(tx1b_txid)
self.log.info(tx1b_txid)
assert(False)
tx1_outpoint = make_utxo(self.nodes[0], int(1.1*COIN))