Skip to content

Commit

Permalink
Makes Features::from_be_bytes public
Browse files Browse the repository at this point in the history
Downstream projects building Feature<T> are most likely doing so with a
big-endian byte array, however only `from_le_bytes` is exposed.
  • Loading branch information
sr-gi committed Oct 3, 2023
1 parent 9b1b724 commit 7b72c6b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lightning/src/ln/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,10 @@ impl<T: sealed::Context> Features<T> {
Ok(())
}

/// Create a Features given a set of flags, in big-endian. This is in byte order from
/// most on-the-wire encodings.
///
/// This is not exported to bindings users as we don't support export across multiple T
fn from_be_bytes(mut flags: Vec<u8>) -> Features<T> {
flags.reverse(); // Swap to little-endian
Self {
Expand Down

0 comments on commit 7b72c6b

Please sign in to comment.