mirror of
https://github.com/ACINQ/eclair.git
synced 2024-11-20 02:27:32 +01:00
only send AvailableBalanceChanged
when needed
We were sending this event everytime we sent a `commit_sig`, which is incorrect because our balance doesn't change if, say, we are signing an incoming htlc. Note that we only send this event in `NORMAL` state, not in `SHUTDOWN` state, because the balance is not really *available* in the latter.
This commit is contained in:
parent
4005720a78
commit
1df3455a72
@ -633,7 +633,10 @@ class Channel(val nodeParams: NodeParams, wallet: EclairWallet, remoteNodeId: Pu
|
||||
self ! TickRefreshChannelUpdate
|
||||
}
|
||||
context.system.eventStream.publish(ChannelSignatureSent(self, commitments1))
|
||||
context.system.eventStream.publish(AvailableBalanceChanged(self, d.channelId, d.shortChannelId, nextRemoteCommit.spec.toRemoteMsat, commitments1)) // note that remoteCommit.toRemote == toLocal
|
||||
if (nextRemoteCommit.spec.toRemoteMsat != d.commitments.remoteCommit.spec.toRemoteMsat) {
|
||||
// we send this event only when our balance changes (note that remoteCommit.toRemote == toLocal)
|
||||
context.system.eventStream.publish(AvailableBalanceChanged(self, d.channelId, d.shortChannelId, nextRemoteCommit.spec.toRemoteMsat, commitments1))
|
||||
}
|
||||
// we expect a quick response from our peer
|
||||
setTimer(RevocationTimeout.toString, RevocationTimeout(commitments1.remoteCommit.index, peer = context.parent), timeout = nodeParams.revocationTimeout, repeat = false)
|
||||
handleCommandSuccess(sender, store(d.copy(commitments = commitments1))) sending commit
|
||||
|
Loading…
Reference in New Issue
Block a user