@@ -698,7 +698,7 @@ impl VersionedBlockMarker {
698698 }
699699
700700 /// Serializes to bytes with version prefix.
701- fn to_bytes ( & self ) -> Result < Vec < u8 > , BlockComponentError > {
701+ pub fn to_bytes ( & self ) -> Result < Vec < u8 > , BlockComponentError > {
702702 let marker_bytes = match self {
703703 Self :: V1 ( marker) | Self :: Current ( marker) => marker. to_bytes ( ) ,
704704 } ?;
@@ -882,7 +882,7 @@ impl BlockMarkerV1 {
882882 const LENGTH_FIELD_SIZE : u64 = 2 ;
883883
884884 /// Serializes to bytes with variant ID and byte length prefix.
885- fn to_bytes ( & self ) -> Result < Vec < u8 > , BlockComponentError > {
885+ pub fn to_bytes ( & self ) -> Result < Vec < u8 > , BlockComponentError > {
886886 let ( variant_id, data_bytes) = match self {
887887 Self :: BlockFooter ( footer) => ( 0_u8 , footer. to_bytes ( ) ?) ,
888888 Self :: BlockHeader ( header) => ( 1_u8 , header. to_bytes ( ) ?) ,
@@ -997,7 +997,7 @@ impl BlockFooterV1 {
997997 }
998998
999999 /// Serializes to bytes with user agent length capping.
1000- fn to_bytes ( & self ) -> Result < Vec < u8 > , BlockComponentError > {
1000+ pub fn to_bytes ( & self ) -> Result < Vec < u8 > , BlockComponentError > {
10011001 let mut buffer = Vec :: with_capacity (
10021002 Self :: HASH_SIZE
10031003 + Self :: TIMESTAMP_SIZE
@@ -1090,7 +1090,7 @@ impl VersionedBlockFooter {
10901090 }
10911091
10921092 /// Serializes to bytes with version prefix.
1093- fn to_bytes ( & self ) -> Result < Vec < u8 > , BlockComponentError > {
1093+ pub fn to_bytes ( & self ) -> Result < Vec < u8 > , BlockComponentError > {
10941094 let footer = match self {
10951095 Self :: V1 ( footer) | Self :: Current ( footer) => footer,
10961096 } ;
@@ -1174,13 +1174,13 @@ impl BlockHeaderV1 {
11741174 }
11751175
11761176 /// Serializes to bytes using bincode.
1177- fn to_bytes ( & self ) -> Result < Vec < u8 > , BlockComponentError > {
1177+ pub fn to_bytes ( & self ) -> Result < Vec < u8 > , BlockComponentError > {
11781178 bincode:: serialize ( self )
11791179 . map_err ( |e| BlockComponentError :: SerializationFailed ( e. to_string ( ) ) )
11801180 }
11811181
11821182 /// Deserializes from bytes using bincode.
1183- fn from_bytes ( data : & [ u8 ] ) -> Result < Self , BlockComponentError > {
1183+ pub fn from_bytes ( data : & [ u8 ] ) -> Result < Self , BlockComponentError > {
11841184 bincode:: deserialize ( data)
11851185 . map_err ( |e| BlockComponentError :: DeserializationFailed ( e. to_string ( ) ) )
11861186 }
@@ -1213,7 +1213,7 @@ impl VersionedBlockHeader {
12131213 }
12141214
12151215 /// Serializes to bytes with version prefix.
1216- fn to_bytes ( & self ) -> Result < Vec < u8 > , BlockComponentError > {
1216+ pub fn to_bytes ( & self ) -> Result < Vec < u8 > , BlockComponentError > {
12171217 let header = match self {
12181218 Self :: V1 ( header) | Self :: Current ( header) => header,
12191219 } ;
@@ -1227,7 +1227,7 @@ impl VersionedBlockHeader {
12271227 }
12281228
12291229 /// Deserializes from bytes, always creating Current variant.
1230- fn from_bytes ( data : & [ u8 ] ) -> Result < Self , BlockComponentError > {
1230+ pub fn from_bytes ( data : & [ u8 ] ) -> Result < Self , BlockComponentError > {
12311231 let ( _version, remaining) = data
12321232 . split_first ( )
12331233 . ok_or ( BlockComponentError :: InsufficientData ) ?;
@@ -1297,13 +1297,13 @@ impl UpdateParentV1 {
12971297 }
12981298
12991299 /// Serializes to bytes using bincode.
1300- fn to_bytes ( & self ) -> Result < Vec < u8 > , BlockComponentError > {
1300+ pub fn to_bytes ( & self ) -> Result < Vec < u8 > , BlockComponentError > {
13011301 bincode:: serialize ( self )
13021302 . map_err ( |e| BlockComponentError :: SerializationFailed ( e. to_string ( ) ) )
13031303 }
13041304
13051305 /// Deserializes from bytes using bincode.
1306- fn from_bytes ( data : & [ u8 ] ) -> Result < Self , BlockComponentError > {
1306+ pub fn from_bytes ( data : & [ u8 ] ) -> Result < Self , BlockComponentError > {
13071307 bincode:: deserialize ( data)
13081308 . map_err ( |e| BlockComponentError :: DeserializationFailed ( e. to_string ( ) ) )
13091309 }
@@ -1336,7 +1336,7 @@ impl VersionedUpdateParent {
13361336 }
13371337
13381338 /// Serializes to bytes with version prefix.
1339- fn to_bytes ( & self ) -> Result < Vec < u8 > , BlockComponentError > {
1339+ pub fn to_bytes ( & self ) -> Result < Vec < u8 > , BlockComponentError > {
13401340 let update = match self {
13411341 Self :: V1 ( update) | Self :: Current ( update) => update,
13421342 } ;
0 commit comments