Add htlcMaximumMsat field to ChannelUpdate message#679
Conversation
| .typecase(UPDATE | 13, (("expiry" | uint32) :: ("channelUpdate" | channelUpdateWithLengthCodec)).as[IncorrectCltvExpiry]) | ||
| .typecase(UPDATE | 14, (("channelUpdate" | channelUpdateWithLengthCodec)).as[ExpiryTooSoon]) | ||
| .typecase(UPDATE | 20, (("flags" | binarydata(2)) :: ("channelUpdate" | channelUpdateWithLengthCodec)).as[ChannelDisabled]) | ||
| .typecase(UPDATE | 20, (("flags" | binarydata(1)) :: ("channelUpdate" | channelUpdateWithLengthCodec)).as[ChannelDisabled]) |
There was a problem hiding this comment.
That's not compliant, the UPDATE|20 message still includes the 2-bytes flags.
There was a problem hiding this comment.
Do I have to change value back to 2 there?
| ("feeBaseMsat" | uint32) :: | ||
| ("feeProportionalMillionths" | uint32)) | ||
| ("feeProportionalMillionths" | uint32) :: | ||
| ("htlcMaximumMsat" | optional(bool, uint64))) |
There was a problem hiding this comment.
That's not compliant: this encoding will prefix the htlc_maximum_msat field by a bit telling if there is data or not. Instead the bit should be set in the message_flags field.
One way to do it is to add a require in the ChannelUpdate constructor that makes sure that the flag is set when the optional field is defined, and use a conditional codec with a >>:~ operator, à la:
Let me know if you need help with this.
There was a problem hiding this comment.
Btw this bit is also what causes the test error in FailureMessageCodecsSpec.
There was a problem hiding this comment.
Thanks, I've decided to use flatAppend because >>:~ produces an hlist of different structure.
|
Looks like parent branch/repo was deleted. |
The only test failure is at
failureMessageCodecwhich can't encode newChannelUpdateformat with the following message:don't yet understand why this is happening.