Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make htlc_maximum_msat mandatory in channel updates #2361

Merged
merged 2 commits into from
Aug 8, 2022

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Aug 3, 2022

The specification is removing support for old channel updates that didn't include an htlc_maximum_msat (lightning/bolts#996).

Every implementation has been generating updates containing this field for years, so we can safely reject updates that don't contain it.

@t-bast t-bast requested review from pm47 and sstone August 3, 2022 15:22
@@ -100,38 +100,6 @@ class ChannelCodecsSpec extends AnyFunSuite {
assert(data_new == data_new2)
}

test("backward compatibility DATA_NORMAL_COMPAT_03_Codec (roundtrip)") {
Copy link
Member Author

Choose a reason for hiding this comment

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

I tried fixing this test, but it's a real pain because it uses one of our oldest codecs that has been updated years ago. I think we can safely drop it.

@t-bast t-bast force-pushed the htlc-maximum-msat-mandatory branch from ec83a24 to 654d9f7 Compare August 3, 2022 15:34
The specification is removing support for old channel updates that didn't
include an `htlc_maximum_msat` (lightning/bolts#996).

Every implementation has been generating updates containing this field for
years, so we can safely reject updates that don't contain it.
@codecov-commenter
Copy link

codecov-commenter commented Aug 3, 2022

Codecov Report

Merging #2361 (06b4ad9) into master (85fea72) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #2361      +/-   ##
==========================================
+ Coverage   84.71%   84.74%   +0.02%     
==========================================
  Files         194      194              
  Lines       14671    14667       -4     
  Branches      604      597       -7     
==========================================
+ Hits        12428    12429       +1     
+ Misses       2243     2238       -5     
Impacted Files Coverage Δ
...e/src/main/scala/fr/acinq/eclair/router/Sync.scala 98.39% <ø> (ø)
...c/main/scala/fr/acinq/eclair/db/pg/PgAuditDb.scala 99.67% <100.00%> (ø)
...cala/fr/acinq/eclair/db/sqlite/SqliteAuditDb.scala 99.65% <100.00%> (ø)
...n/scala/fr/acinq/eclair/router/Announcements.scala 100.00% <100.00%> (ø)
...src/main/scala/fr/acinq/eclair/router/Router.scala 94.23% <100.00%> (ø)
.../eclair/wire/protocol/LightningMessageCodecs.scala 100.00% <100.00%> (ø)
...q/eclair/wire/protocol/LightningMessageTypes.scala 97.77% <100.00%> (ø)
...main/scala/fr/acinq/eclair/io/PeerConnection.scala 87.13% <0.00%> (+1.10%) ⬆️
...clair/channel/publish/ReplaceableTxPublisher.scala 75.48% <0.00%> (+1.29%) ⬆️

tlvStream: TlvStream[ChannelUpdateTlv] = TlvStream.empty) extends RoutingMessage with AnnouncementMessage with HasTimestamp with HasChainHash {

def messageFlags: Byte = if (htlcMaximumMsat.isDefined) 1 else 0
def messageFlags: Byte = 1
Copy link
Member

Choose a reason for hiding this comment

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

We need this to construct ChannelDisabled error messages, which should really only use channelFlags.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it looks a bit weird here if it's just a constant, but if we reintroduce more message flags (such as in #2362) it makes a bit more sense. Let's see if #2362 is accepted at the spec level and we'll see.

@t-bast t-bast merged commit c71c3b4 into master Aug 8, 2022
@t-bast t-bast deleted the htlc-maximum-msat-mandatory branch August 8, 2022 13:05
t-bast added a commit that referenced this pull request Aug 11, 2022
Following #2361, we reject channel updates that don't contain the
`htlc_maximum_msat` field. However, the network DB may contain such
channel updates, that we need to remove when starting up.
t-bast added a commit that referenced this pull request Aug 11, 2022
Following #2361, we reject channel updates that don't contain the
`htlc_maximum_msat` field. However, the network DB may contain such
channel updates, that we need to remove when starting up.
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