Browse Source

pytest: Add withdraw test after permfail to test unilateral_close

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
parent
commit
5c91a3449a
  1. 16
      tests/test_lightningd.py

16
tests/test_lightningd.py

@ -782,8 +782,6 @@ class LightningDTests(BaseLightningDTests):
l1.daemon.wait_for_log(r'Owning output .* txid %s' % closetxid) l1.daemon.wait_for_log(r'Owning output .* txid %s' % closetxid)
l2.daemon.wait_for_log(r'Owning output .* txid %s' % closetxid) l2.daemon.wait_for_log(r'Owning output .* txid %s' % closetxid)
print(l1.rpc.listfunds())
# Make sure both nodes have grabbed their close tx funds # Make sure both nodes have grabbed their close tx funds
assert closetxid in set([o['txid'] for o in l1.rpc.listfunds()['outputs']]) assert closetxid in set([o['txid'] for o in l1.rpc.listfunds()['outputs']])
assert closetxid in set([o['txid'] for o in l2.rpc.listfunds()['outputs']]) assert closetxid in set([o['txid'] for o in l2.rpc.listfunds()['outputs']])
@ -807,6 +805,11 @@ class LightningDTests(BaseLightningDTests):
l2.daemon.wait_for_log('Failing due to dev-fail command') l2.daemon.wait_for_log('Failing due to dev-fail command')
l2.daemon.wait_for_log('sendrawtx exit 0') l2.daemon.wait_for_log('sendrawtx exit 0')
assert l1.bitcoin.rpc.getmempoolinfo()['size'] == 1
# Now grab the close transaction
closetxid = l1.bitcoin.rpc.getrawmempool(False)[0]
# "Internal error" in hex # "Internal error" in hex
l1.daemon.wait_for_log('WIRE_ERROR.*496e7465726e616c206572726f72') l1.daemon.wait_for_log('WIRE_ERROR.*496e7465726e616c206572726f72')
@ -833,6 +836,15 @@ class LightningDTests(BaseLightningDTests):
bitcoind.generate_block(5) bitcoind.generate_block(5)
l2.daemon.wait_for_log('onchaind complete, forgetting peer') l2.daemon.wait_for_log('onchaind complete, forgetting peer')
# Only l1 has a direct output since all of l2's outputs are respent (it failed)
assert closetxid in set([o['txid'] for o in l1.rpc.listfunds()['outputs']])
#import pdb; pdb.set_trace()
addr = l1.bitcoin.rpc.getnewaddress()
print(addr)
l1.rpc.withdraw(addr, "all")
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1") @unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1")
def test_onchain_first_commit(self): def test_onchain_first_commit(self):
"""Onchain handling where funder immediately drops to chain""" """Onchain handling where funder immediately drops to chain"""

Loading…
Cancel
Save