Please sign in to comment.
Smarter strategy for sending `channel_update`s (#950)
The goal is to prevent sending a lot of updates for flappy channels. Instead of sending a disabled `channel_update` after each disconnection, we now wait for a payment to try to route through the channel and only then reply with a disabled `channel_update` and broadcast it on the network. The reason is that in case of a disconnection, if noone cares about that channel then there is no reason to tell everyone about its current (disconnected) state. In addition to that, when switching from `SYNCING`->`NORMAL`, instead of emitting a new `channel_update` with flag=enabled right away, we wait a little bit and send it later. We also don't send a new `channel_update` if it is identical to the previous one (except if the previous one is outdated). This way, if a connection to a peer is unstable and we keep getting disconnected/reconnected, we won't spam the network. The extra delay allows us to remove the change made in #888, which was a workaround in case we generated `channel_update` too quickly. Also, increased refresh interval from 7 days to 10 days. There was no need to be so conservative. Note that on startup we still need to re-send `channel_update` for all channels in order to properly initialize the `Router` and the `Relayer`. Otherwise they won't know about those channels, and e.g. the `Relayer` will return `UnknownNextPeer` errors. But we don't need to create new `channel_update`s in most cases, so this should have little or no impact to gossip because our peers will already know the updates and will filter them out. On the other hand, if some global parameters (like relaying fees) are changed, it will cause the creation a new `channel_update` for all channels.
- Loading branch information...
Showing with 236 additions and 101 deletions.
- +97 −46 eclair-core/src/main/scala/fr/acinq/eclair/channel/Channel.scala
- +19 −1 eclair-core/src/main/scala/fr/acinq/eclair/channel/Helpers.scala
- +2 −1 eclair-core/src/main/scala/fr/acinq/eclair/payment/LocalPaymentHandler.scala
- +1 −0 eclair-core/src/main/scala/fr/acinq/eclair/router/Announcements.scala
- +2 −3 eclair-core/src/main/scala/fr/acinq/eclair/router/Router.scala
- +3 −0 eclair-core/src/main/scala/fr/acinq/eclair/wire/ChannelCodecs.scala
- +11 −0 eclair-core/src/test/scala/fr/acinq/eclair/channel/HelpersSpec.scala
- +70 −9 eclair-core/src/test/scala/fr/acinq/eclair/channel/states/e/NormalStateSpec.scala
- +15 −30 eclair-core/src/test/scala/fr/acinq/eclair/channel/states/e/OfflineStateSpec.scala
- +12 −10 eclair-core/src/test/scala/fr/acinq/eclair/integration/IntegrationSpec.scala
- +1 −1 eclair-core/src/test/scala/fr/acinq/eclair/router/RouterSpec.scala
- +3 −0 eclair-core/src/test/scala/fr/acinq/eclair/wire/ChannelCodecsSpec.scala
Oops, something went wrong.
Oops, something went wrong.