Skip to content

minFinalExpiryDelta is not optional#2195

Merged
thomash-acinq merged 3 commits into
masterfrom
minFinalExpiryDelta-from-spec
Mar 2, 2022
Merged

minFinalExpiryDelta is not optional#2195
thomash-acinq merged 3 commits into
masterfrom
minFinalExpiryDelta-from-spec

Conversation

@thomash-acinq
Copy link
Copy Markdown
Contributor

In invoices, minFinalCltvExpiryDelta is not optional.

An invoice that doesn't explicitly set min_final_cltv_expiry has an default min_final_cltv_expiry of 18.
This default allows invoices to be slightly shorter but does not mean that the min_final_cltv_expiry can be unknown and needs to be provided from somewhere else.

@thomash-acinq thomash-acinq requested review from pm47 and t-bast and removed request for pm47 March 1, 2022 11:38
Copy link
Copy Markdown
Member

@pm47 pm47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got confused at first: we cannot put a hard requirement on the existence of that field in Bolt11Invoice along the existing ones, because it wasn't always mandatory (lightning/bolts#785):

require(tags.collect { case _: Bolt11Invoice.MinFinalCltvExpiry=> }.size == 1, "there must be exactly one min_final_cltv_expiry tag")

Comment thread eclair-core/src/main/scala/fr/acinq/eclair/payment/Bolt11Invoice.scala Outdated
An invoice that doesn't explicitly set min_final_cltv_expiry has an default min_final_cltv_expiry of 18.
This default allows invoices to be slightly shorter but does not mean that the min_final_cltv_expiry can be unknown and needs to be provided from somewhere else.
@thomash-acinq thomash-acinq force-pushed the minFinalExpiryDelta-from-spec branch from b36d22f to 0edf486 Compare March 1, 2022 16:02
@thomash-acinq thomash-acinq force-pushed the minFinalExpiryDelta-from-spec branch from 0edf486 to f879a97 Compare March 1, 2022 16:27
Comment thread eclair-core/src/main/scala/fr/acinq/eclair/json/JsonSerializers.scala Outdated
Comment thread eclair-core/src/main/scala/fr/acinq/eclair/payment/Bolt11Invoice.scala Outdated
Comment thread eclair-core/src/main/scala/fr/acinq/eclair/channel/Channel.scala
@thomash-acinq thomash-acinq force-pushed the minFinalExpiryDelta-from-spec branch from aaabecc to 607271a Compare March 2, 2022 09:26
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Merging #2195 (607271a) into master (67fb392) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #2195      +/-   ##
==========================================
- Coverage   83.95%   83.95%   -0.01%     
==========================================
  Files         186      186              
  Lines       13916    13915       -1     
  Branches      578      564      -14     
==========================================
- Hits        11683    11682       -1     
  Misses       2233     2233              
Impacted Files Coverage Δ
...n/scala/fr/acinq/eclair/json/JsonSerializers.scala 91.17% <ø> (ø)
...c/main/scala/fr/acinq/eclair/payment/Invoice.scala 100.00% <ø> (ø)
...r-core/src/main/scala/fr/acinq/eclair/Eclair.scala 50.84% <100.00%> (+0.28%) ⬆️
...c/main/scala/fr/acinq/eclair/channel/Channel.scala 87.81% <100.00%> (-0.08%) ⬇️
.../scala/fr/acinq/eclair/payment/Bolt11Invoice.scala 92.22% <100.00%> (ø)
...cinq/eclair/payment/receive/MultiPartHandler.scala 93.61% <100.00%> (ø)
...r/acinq/eclair/payment/send/PaymentInitiator.scala 90.47% <100.00%> (ø)
...q/eclair/channel/publish/ReplaceableTxFunder.scala 90.57% <0.00%> (-1.58%) ⬇️
...main/scala/fr/acinq/eclair/io/PeerConnection.scala 85.60% <0.00%> (-0.38%) ⬇️
... and 2 more

Copy link
Copy Markdown
Member

@pm47 pm47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup!

@thomash-acinq thomash-acinq merged commit ab30af8 into master Mar 2, 2022
@thomash-acinq thomash-acinq deleted the minFinalExpiryDelta-from-spec branch March 2, 2022 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants