Makes Features::from_be_bytes public
authorSergi Delgado Segura <sergi.delgado.s@gmail.com>
Tue, 3 Oct 2023 12:46:18 +0000 (08:46 -0400)
committerSergi Delgado Segura <sergi.delgado.s@gmail.com>
Thu, 5 Oct 2023 19:27:13 +0000 (15:27 -0400)
Downstream projects building Feature<T> are most likely doing so with a
big-endian byte array, however only `from_le_bytes` is exposed.

lightning/src/ln/features.rs

index bcaa91ab266fe7f10ebbc8de710fc30d927365c3..d10c3a71927b254854fd11869f1d9cbaedf7cb35 100644 (file)
@@ -718,7 +718,11 @@ impl<T: sealed::Context> Features<T> {
                Ok(())
        }
 
-       fn from_be_bytes(mut flags: Vec<u8>) -> Features<T> {
+       /// 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
+       pub fn from_be_bytes(mut flags: Vec<u8>) -> Features<T> {
                flags.reverse(); // Swap to little-endian
                Self {
                        flags,