mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
fix: suppress duplicated channel_state_changed events
This commit is contained in:
committed by
Rusty Russell
parent
ddc759c49e
commit
160c564e5f
@@ -399,13 +399,15 @@ void channel_set_state(struct channel *channel,
|
||||
wallet_channel_save(channel->peer->ld->wallet, channel);
|
||||
|
||||
/* plugin notification channel_state_changed */
|
||||
derive_channel_id(&cid, &channel->funding_txid, channel->funding_outnum);
|
||||
notify_channel_state_changed(channel->peer->ld,
|
||||
&channel->peer->id,
|
||||
&cid,
|
||||
channel->scid,
|
||||
old_state,
|
||||
state);
|
||||
if (state != old_state) { /* see issue #4029 */
|
||||
derive_channel_id(&cid, &channel->funding_txid, channel->funding_outnum);
|
||||
notify_channel_state_changed(channel->peer->ld,
|
||||
&channel->peer->id,
|
||||
&cid,
|
||||
channel->scid,
|
||||
old_state,
|
||||
state);
|
||||
}
|
||||
}
|
||||
|
||||
void channel_fail_permanent(struct channel *channel, const char *fmt, ...)
|
||||
|
||||
@@ -731,14 +731,6 @@ def test_channel_state_changed_unilateral(node_factory, bitcoind):
|
||||
|
||||
bitcoind.generate_block(100) # so it gets settled
|
||||
|
||||
msg = l2.daemon.wait_for_log("channel_state_changed.*new_state.*")
|
||||
event = ast.literal_eval(re.findall(".*({.*}).*", msg)[0])
|
||||
assert(event['peer_id'] == peer_id)
|
||||
assert(event['channel_id'] == cid)
|
||||
assert(event['short_channel_id'] == scid)
|
||||
assert(event['old_state'] == "AWAITING_UNILATERAL") # this actually happens
|
||||
assert(event['new_state'] == "AWAITING_UNILATERAL") # note: same states
|
||||
|
||||
msg = l2.daemon.wait_for_log("channel_state_changed.*new_state.*")
|
||||
event = ast.literal_eval(re.findall(".*({.*}).*", msg)[0])
|
||||
assert(event['peer_id'] == peer_id)
|
||||
|
||||
Reference in New Issue
Block a user