-
Notifications
You must be signed in to change notification settings - Fork 384
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
Trivial post-#3604 cleanups #3631
base: main
Are you sure you want to change the base?
Trivial post-#3604 cleanups #3631
Conversation
e23d32d removed support for reading ancient `Channel`s but left a bit of cleanup for later. Here we clean up deserialization a bit by removing old v1 channel read logic.
e23d32d removed support for reading ancient `Channel`s but left a bit of cleanup for later. Here we mark a few TLVs as `required` which were always written in 0.0.113.
21ed477 got rewritten a few times before it landed and ended up with a spurious set call which is redaundant against the parameter passed in to `ReadableArgs`. This removes that set.
// `user_id` used to be a single u64 value. In order to remain backwards compatible with | ||
// versions prior to 0.0.113, the u128 is serialized as two separate u64 values. We read | ||
// the low bytes now and the high bytes later. | ||
let user_id_low: u64 = Readable::read(reader)?; | ||
|
||
let mut config = Some(LegacyChannelConfig::default()); | ||
if ver == 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a few more of these further down this method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TheBlueMatt Yeah, see #3632. Didn't see this PR before opening that. Happy to close it if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cherry-picked the extra commit on that branch in case you want to take it.
@@ -10305,22 +10305,17 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch | |||
let (entropy_source, signer_provider, serialized_height, our_supported_features) = args; | |||
let ver = read_ver_prefix!(reader, SERIALIZATION_VERSION); | |||
|
|||
if ver <= 2 { | |||
return Err(DecodeError::InvalidValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, #3632 uses UnknownVersion
instead. Not sure which you'd prefer.
// `user_id` used to be a single u64 value. In order to remain backwards compatible with | ||
// versions prior to 0.0.113, the u128 is serialized as two separate u64 values. We read | ||
// the low bytes now and the high bytes later. | ||
let user_id_low: u64 = Readable::read(reader)?; | ||
|
||
let mut config = Some(LegacyChannelConfig::default()); | ||
if ver == 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cherry-picked the extra commit on that branch in case you want to take it.
A few small cleanups to channel read. I'm sure there's more that can be cleaned up.