ACINQ / eclair

A scala implementation of the Lightning Network.
Apache License 2.0
1.24k stars 266 forks source link

Lost two channels due to feerate difference (mine low, theirs high) #2840

Closed fishcakeday closed 7 months ago

fishcakeday commented 7 months ago

Two channels were force-closed by Eclair 0.10.0 due to feerate differences: remote feeratePerKw=25174 sat/kw, local fee ratePerKw=2500 sat/kw, ratio=10.0696 remote feeratePerKw=25174 sat/kw, local fee ratePerKw=2500 sat/kw, ratio=10.0696

Given that peers fees were too high, I expected that 36a3c8897cae18fe3ef219e24140b8d9c25bf239 would have avoided that closure.

Channels were force-closed

Probably 100% reproducible when the feerate ratio is as shown in the logs.

0.10.0 - compiled from the GitHub cloned code and with the tag checked out.

adoptopenjdk/openjdk11:x86_64-ubuntu-jre-11.0.22_7

Channel 1

2024-03-16 06:27:48,334 INFO  f.a.e.c.fsm.Channel n:...snip... c:...snip... - remote feeratePerKw=25174 sat/kw, local fee ratePerKw=2500 sat/kw, ratio=10.0696
2024-03-16 06:27:48,334 ERROR f.a.e.c.fsm.Channel n:...snip... c:...snip... - local/remote feerates are too different: re
moteFeeratePerKw=25174 localFeeratePerKw=2500 while processing msg=UpdateFee in state=NORMAL
2024-03-16 06:27:48,334 INFO  f.a.e.c.fsm.Channel n:...snip... c:...snip... - using finalScriptPubkey=ByteVector(22 bytes
, 0x00144287309a7e644942d98c91783c7f2885454149c8)
2024-03-16 06:27:48,334 ERROR f.a.e.c.fsm.Channel n:...snip... c:...snip... - force-closing with fundingIndex=0

Channel 2

2024-03-16 06:22:31,291 INFO  f.a.e.c.fsm.Channel n:...snip... c:...snip... - remote feeratePerKw=25173 sat/kw, local fee ratePerKw=2500 sat/kw, ratio=10.0692
2024-03-16 06:22:31,291 ERROR f.a.e.c.fsm.Channel n:...snip... c:...snip... - local/remote feerates are too different: re
moteFeeratePerKw=25173 localFeeratePerKw=2500 while processing msg=UpdateFee in state=NORMAL
2024-03-16 06:22:31,291 INFO  f.a.e.c.fsm.Channel n:...snip... c:...snip... - using finalScriptPubkey=ByteVector(22 bytes
, 0x0014c42b639009ffbada8789efe840b2bab484a49e8c)
2024-03-16 06:22:31,291 ERROR f.a.e.c.fsm.Channel n:...snip... c:...snip... - force-closing with fundingIndex=0
t-bast commented 7 months ago

That is expected behavior, your peer's feerate estimation seems off (your local 10 sat/byte estimation better matches the mempool conditions). When that happens, the specification mandates force-closing to protect against potentially malicious peers. By default, we use a ratio of 10x: https://github.com/ACINQ/eclair/blob/c8184b3e43a603454d672aed61b2ae461a80e1a8/eclair-core/src/main/resources/reference.conf#L260

But you may want to override that default value in your eclair.conf if your peers seem to overestimate the feerate and you're willing to take the "risk" of overpaying commit tx fees. You can also change that ratio for specific peers using the following per-peer setting: https://github.com/ACINQ/eclair/blob/c8184b3e43a603454d672aed61b2ae461a80e1a8/eclair-core/src/main/resources/reference.conf#L275

fishcakeday commented 7 months ago

Ok, that makes sense. I may have misunderstood the change that I was referencing, where it was supposed to do not FC the channel when Eclair fees are lower than the peer's. Thanks for clarification.