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

Fix encoding of failure messages (fixes #363) #366

Merged
merged 3 commits into from
Jan 11, 2018
Merged

Conversation

sstone
Copy link
Member

@sstone sstone commented Jan 10, 2018

When a failure message includes a channel update field, this field must be encoded as:
[ len | channel update]
And we did not include the len field.

When a ailure message includes a channel update field, this field must be encoded as:
[ len | channel update]
And we did not include the len field.
Copy link
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.

Looks good overall, but encoding of IncorrectCltvExpiry seems wrong

.typecase(UPDATE | 20, (("flags" | binarydata(2)) :: ("channelUpdate" | channelUpdateCodec)).as[ChannelDisabled])
.typecase(UPDATE | 11, (("amountMsat" | uint64) :: ("channelUpdate" | channelUpdateWithLengthCodec)).as[AmountBelowMinimum])
.typecase(UPDATE | 12, (("amountMsat" | uint64) :: ("channelUpdate" | channelUpdateWithLengthCodec)).as[FeeInsufficient])
.typecase(UPDATE | 13, (("expiry" | uint32) :: ("channelUpdate" | ("channelUpdate" | variableSizeBytes(uint16, channelUpdateCodec)))).as[IncorrectCltvExpiry])
Copy link
Member

Choose a reason for hiding this comment

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

.typecase(UPDATE | 13, (("expiry" | uint32) :: ("channelUpdate" | ("channelUpdate" | variableSizeBytes(uint16, channelUpdateCodec)))).as[IncorrectCltvExpiry])

seems wrong

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.

2 participants