|
@ -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') |
|
|
|
|
|
|
|
|