mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 10:46:58 +01:00
pytest: Replace wait_for_channels with an actual check
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
ba31dd2d9d
commit
202ce5e4ea
2 changed files with 10 additions and 1 deletions
|
@ -3857,7 +3857,8 @@ class LightningDTests(BaseLightningDTests):
|
|||
assert l2.rpc.listinvoices('inv1')['invoices'][0]['status'] == 'paid'
|
||||
|
||||
# FIXME: We should re-add pre-announced routes on startup!
|
||||
self.wait_for_routes(l1, [chanid])
|
||||
l1.bitcoin.rpc.generate(5)
|
||||
l1.wait_channel_active(chanid)
|
||||
|
||||
# A duplicate should succeed immediately (nop) and return correct preimage.
|
||||
preimage = l1.rpc.pay(inv1['bolt11'])['payment_preimage']
|
||||
|
|
|
@ -459,3 +459,11 @@ class LightningNode(object):
|
|||
# Intermittent decoding failure. See if it decodes badly twice?
|
||||
decoded2 = self.bitcoin.rpc.decoderawtransaction(tx)
|
||||
raise ValueError("Can't find {} payment in {} (1={} 2={})".format(amount, tx, decoded, decoded2))
|
||||
|
||||
def is_channel_active(self, chanid):
|
||||
channels = self.rpc.listchannels()['channels']
|
||||
active = [(c['short_channel_id'], c['flags']) for c in channels if c['active']]
|
||||
return (chanid, 0) in active and (chanid, 1) in active
|
||||
|
||||
def wait_channel_active(self, chanid):
|
||||
wait_for(lambda: self.is_channel_active(chanid), interval=1)
|
||||
|
|
Loading…
Add table
Reference in a new issue