mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +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);
|
wallet_channel_save(channel->peer->ld->wallet, channel);
|
||||||
|
|
||||||
/* plugin notification channel_state_changed */
|
/* plugin notification channel_state_changed */
|
||||||
derive_channel_id(&cid, &channel->funding_txid, channel->funding_outnum);
|
if (state != old_state) { /* see issue #4029 */
|
||||||
notify_channel_state_changed(channel->peer->ld,
|
derive_channel_id(&cid, &channel->funding_txid, channel->funding_outnum);
|
||||||
&channel->peer->id,
|
notify_channel_state_changed(channel->peer->ld,
|
||||||
&cid,
|
&channel->peer->id,
|
||||||
channel->scid,
|
&cid,
|
||||||
old_state,
|
channel->scid,
|
||||||
state);
|
old_state,
|
||||||
|
state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void channel_fail_permanent(struct channel *channel, const char *fmt, ...)
|
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
|
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.*")
|
msg = l2.daemon.wait_for_log("channel_state_changed.*new_state.*")
|
||||||
event = ast.literal_eval(re.findall(".*({.*}).*", msg)[0])
|
event = ast.literal_eval(re.findall(".*({.*}).*", msg)[0])
|
||||||
assert(event['peer_id'] == peer_id)
|
assert(event['peer_id'] == peer_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user