mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
df-tests: test_channel_state_changed_bilateral
This commit is contained in:
parent
450a094d26
commit
ac88c72f1e
2 changed files with 30 additions and 6 deletions
|
@ -440,7 +440,6 @@ void channel_set_state(struct channel *channel,
|
|||
enum state_change reason,
|
||||
char *why)
|
||||
{
|
||||
struct channel_id cid;
|
||||
struct timeabs timestamp;
|
||||
|
||||
/* set closer, if known */
|
||||
|
@ -478,10 +477,9 @@ void channel_set_state(struct channel *channel,
|
|||
state,
|
||||
reason,
|
||||
why);
|
||||
derive_channel_id(&cid, &channel->funding_txid, channel->funding_outnum);
|
||||
notify_channel_state_changed(channel->peer->ld,
|
||||
&channel->peer->id,
|
||||
&cid,
|
||||
&channel->cid,
|
||||
channel->scid,
|
||||
×tamp,
|
||||
old_state,
|
||||
|
|
|
@ -690,17 +690,43 @@ def test_channel_state_changed_bilateral(node_factory, bitcoind):
|
|||
assert(l2.rpc.listpeers()['peers'][0]['channels'][0]['closer'] is None)
|
||||
|
||||
event1 = wait_for_event(l1)
|
||||
event2 = wait_for_event(l2)
|
||||
if l1.config('experimental-dual-fund'):
|
||||
# Dual funded channels have an extra state change
|
||||
assert(event1['peer_id'] == l2_id) # we only test these IDs the first time
|
||||
assert(event1['channel_id'] == cid)
|
||||
assert(event1['short_channel_id'] is None)
|
||||
assert(event1['old_state'] == "DUALOPEND_OPEN_INIT")
|
||||
assert(event1['new_state'] == "DUALOPEND_AWAITING_LOCKIN")
|
||||
assert(event1['cause'] == "user")
|
||||
assert(event1['message'] == "Sigs exchanged, waiting for lock-in")
|
||||
event1 = wait_for_event(l1)
|
||||
assert(event2['peer_id'] == l1_id) # we only test these IDs the first time
|
||||
assert(event2['channel_id'] == cid)
|
||||
assert(event2['short_channel_id'] is None)
|
||||
assert(event2['old_state'] == "DUALOPEND_OPEN_INIT")
|
||||
assert(event2['new_state'] == "DUALOPEND_AWAITING_LOCKIN")
|
||||
assert(event2['cause'] == "remote")
|
||||
assert(event2['message'] == "Sigs exchanged, waiting for lock-in")
|
||||
event2 = wait_for_event(l2)
|
||||
|
||||
assert(event1['peer_id'] == l2_id) # we only test these IDs the first time
|
||||
assert(event1['channel_id'] == cid)
|
||||
assert(event1['short_channel_id'] == scid)
|
||||
if l1.config('experimental-dual-fund'):
|
||||
assert(event1['old_state'] == "DUALOPEND_AWAITING_LOCKIN")
|
||||
else:
|
||||
assert(event1['old_state'] == "CHANNELD_AWAITING_LOCKIN")
|
||||
assert(event1['new_state'] == "CHANNELD_NORMAL")
|
||||
assert(event1['cause'] == "user")
|
||||
assert(event1['message'] == "Lockin complete")
|
||||
event2 = wait_for_event(l2)
|
||||
|
||||
assert(event2['peer_id'] == l1_id)
|
||||
assert(event2['channel_id'] == cid)
|
||||
assert(event2['short_channel_id'] == scid)
|
||||
if l1.config('experimental-dual-fund'):
|
||||
assert(event2['old_state'] == "DUALOPEND_AWAITING_LOCKIN")
|
||||
else:
|
||||
assert(event2['old_state'] == "CHANNELD_AWAITING_LOCKIN")
|
||||
assert(event2['new_state'] == "CHANNELD_NORMAL")
|
||||
assert(event2['cause'] == "remote")
|
||||
|
|
Loading…
Add table
Reference in a new issue