Prefix all stored LN messages by their length#1239
Closed
pm47 wants to merge 1 commit into
Closed
Conversation
Now that we have optional fields at the end of messages, we have to store their length in database, otherwise disasters will happen.
Codecov Report
@@ Coverage Diff @@
## master #1239 +/- ##
==========================================
+ Coverage 76.6% 76.78% +0.17%
==========================================
Files 140 140
Lines 9700 9723 +23
Branches 397 394 -3
==========================================
+ Hits 7431 7466 +35
+ Misses 2269 2257 -12
|
t-bast
reviewed
Dec 9, 2019
Member
t-bast
left a comment
There was a problem hiding this comment.
I think I'd prefer the solution where we create a separate "legacy codecs" file where we put the non-length prefixed ones, and directly change the others here to be length-prefixed.
This duplicates code but makes reading the non-legacy code easier.
|
|
||
| val DATA_WAIT_FOR_FUNDING_CONFIRMED_COMPAT_08_Codec: Codec[DATA_WAIT_FOR_FUNDING_CONFIRMED] = DATA_WAIT_FOR_FUNDING_CONFIRMED_Codec(false) | ||
|
|
||
| val DATA_WAIT_FOR_FUNDING_CONFIRMED_11_Codec: Codec[DATA_WAIT_FOR_FUNDING_CONFIRMED] = DATA_WAIT_FOR_FUNDING_CONFIRMED_Codec(false) |
sstone
reviewed
Dec 9, 2019
| assert(htlcCodec.decodeValue(htlcCodec.encode(htlc2).require).require === htlc2) | ||
| assert(htlcCodec(false).decodeValue(htlcCodec(false).encode(htlc1).require).require === htlc1) | ||
| assert(htlcCodec(false).decodeValue(htlcCodec(false).encode(htlc2).require).require === htlc2) | ||
| assert(htlcCodec(true).decodeValue(htlcCodec(true).encode(htlc2).require).require === htlc2) |
Member
Author
|
Superseded by #1442. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now that we have optional fields at the end of messages, we have to
store their length in database, otherwise disasters will happen.