Browse Source

coin tests: try to make a bit more travis robust

nifty/pset-pre
lisa neigut 5 years ago
committed by Rusty Russell
parent
commit
6e4b4c50f0
  1. 8
      tests/test_closing.py
  2. 3
      tests/test_misc.py

8
tests/test_closing.py

@ -777,11 +777,14 @@ def test_penalty_htlc_tx_fulfill(node_factory, bitcoind):
l2_db_path_bak = os.path.join(l2.daemon.lightning_dir, 'regtest', 'lightningd.sqlite3.bak') l2_db_path_bak = os.path.join(l2.daemon.lightning_dir, 'regtest', 'lightningd.sqlite3.bak')
copyfile(l2_db_path, l2_db_path_bak) copyfile(l2_db_path, l2_db_path_bak)
l2.start() l2.start()
sync_blockheight(bitcoind, [l2])
# push some money from l3->l2, so that the commit counter advances # push some money from l3->l2, so that the commit counter advances
l2.rpc.connect(l3.info['id'], 'localhost', l3.port) l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
l2.daemon.wait_for_log('now ACTIVE') l2.daemon.wait_for_log('now ACTIVE')
inv = l3.rpc.invoice(10**4, '1', 'push') inv = l3.rpc.invoice(10**4, '1', 'push')
# Make sure gossipd in l2 knows it's active
wait_for(lambda: [c['active'] for c in l2.rpc.listchannels(l2.get_channel_scid(l3))['channels']] == [True, True])
l2.rpc.pay(inv['bolt11']) l2.rpc.pay(inv['bolt11'])
# stop both nodes, roll back l2's database # stop both nodes, roll back l2's database
@ -791,6 +794,7 @@ def test_penalty_htlc_tx_fulfill(node_factory, bitcoind):
# start l2 and force close channel with l3 while l3 is still offline # start l2 and force close channel with l3 while l3 is still offline
l2.start() l2.start()
sync_blockheight(bitcoind, [l2])
l2.rpc.close(l3.info['id'], 1) l2.rpc.close(l3.info['id'], 1)
l2.daemon.wait_for_log('sendrawtx exit 0') l2.daemon.wait_for_log('sendrawtx exit 0')
@ -931,11 +935,14 @@ def test_penalty_htlc_tx_timeout(node_factory, bitcoind):
l2_db_path_bak = os.path.join(l2.daemon.lightning_dir, 'regtest', 'lightningd.sqlite3.bak') l2_db_path_bak = os.path.join(l2.daemon.lightning_dir, 'regtest', 'lightningd.sqlite3.bak')
copyfile(l2_db_path, l2_db_path_bak) copyfile(l2_db_path, l2_db_path_bak)
l2.start() l2.start()
sync_blockheight(bitcoind, [l2])
# push some money from l3->l2, so that the commit counter advances # push some money from l3->l2, so that the commit counter advances
l2.rpc.connect(l3.info['id'], 'localhost', l3.port) l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
l2.daemon.wait_for_log('now ACTIVE') l2.daemon.wait_for_log('now ACTIVE')
inv = l3.rpc.invoice(10**4, '1', 'push') inv = l3.rpc.invoice(10**4, '1', 'push')
# Make sure gossipd in l2 knows it's active
wait_for(lambda: [c['active'] for c in l2.rpc.listchannels(l2.get_channel_scid(l3))['channels']] == [True, True])
l2.rpc.pay(inv['bolt11']) l2.rpc.pay(inv['bolt11'])
# stop both nodes, roll back l2's database # stop both nodes, roll back l2's database
@ -945,6 +952,7 @@ def test_penalty_htlc_tx_timeout(node_factory, bitcoind):
# start l2, now back a bit. force close channel with l3 while l3 is still offline # start l2, now back a bit. force close channel with l3 while l3 is still offline
l2.start() l2.start()
sync_blockheight(bitcoind, [l2])
l2.rpc.close(l3.info['id'], 1) l2.rpc.close(l3.info['id'], 1)
l2.daemon.wait_for_log('sendrawtx exit 0') l2.daemon.wait_for_log('sendrawtx exit 0')

3
tests/test_misc.py

@ -605,9 +605,6 @@ def test_withdraw_misc(node_factory, bitcoind, chainparams):
with pytest.raises(RpcError, match=r'Cannot afford transaction'): with pytest.raises(RpcError, match=r'Cannot afford transaction'):
l1.rpc.withdraw(waddr, 'all') l1.rpc.withdraw(waddr, 'all')
# Coins aren't counted as moved until we receive notice they've
# been mined.
assert account_balance(l1, 'wallet') == 11974560000
bitcoind.generate_block(1) bitcoind.generate_block(1)
sync_blockheight(bitcoind, [l1]) sync_blockheight(bitcoind, [l1])
assert account_balance(l1, 'wallet') == 0 assert account_balance(l1, 'wallet') == 0

Loading…
Cancel
Save