File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
beacon_node/lighthouse_network/src/types Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,9 @@ use ssz_types::VariableList;
66use std:: collections:: HashSet ;
77use std:: fmt:: Debug ;
88use std:: sync:: Arc ;
9- use types:: EthSpec ;
109use types:: data:: partial_data_column_sidecar:: { CellBitmap , PartialDataColumn } ;
1110use types:: partial_data_column_sidecar:: PartialDataColumnSidecar ;
11+ use types:: { EthSpec , Hash256 } ;
1212
1313pub type HeaderSentSet = Arc < Mutex < HashSet < PeerId > > > ;
1414
@@ -102,7 +102,10 @@ impl<E: EthSpec> From<CellBitmap<E>> for CellBitmapMetadata<E> {
102102
103103impl < E : EthSpec > Partial for OutgoingPartialColumn < E > {
104104 fn group_id ( & self ) -> Vec < u8 > {
105- self . partial_column . block_root . as_slice ( ) . to_vec ( )
105+ let mut group_id = Vec :: with_capacity ( Hash256 :: len_bytes ( ) + 1 ) ;
106+ group_id. push ( 0 ) ;
107+ group_id. extend_from_slice ( self . partial_column . block_root . as_slice ( ) ) ;
108+ group_id
106109 }
107110
108111 fn metadata ( & self ) -> Vec < u8 > {
Original file line number Diff line number Diff line change @@ -427,7 +427,10 @@ pub fn decode_partial<E: EthSpec>(
427427) -> Result < PartialDataColumn < E > , String > {
428428 match topic. kind ( ) {
429429 GossipKind :: DataColumnSidecar ( id) => {
430- let block_root = Hash256 :: from_ssz_bytes ( group)
430+ if group. first ( ) != Some ( & 0 ) {
431+ return Err ( format ! ( "Unknown data column format: {:?}" , group. first( ) ) ) ;
432+ }
433+ let block_root = Hash256 :: from_ssz_bytes ( & group[ 1 ..] )
431434 . map_err ( |e| format ! ( "Error decoding group: {:?}" , e) ) ?;
432435 let sidecar = PartialDataColumnSidecar :: from_ssz_bytes ( data)
433436 . map_err ( |e| format ! ( "Error decoding sidecar: {:?}" , e) ) ?;
You can’t perform that action at this time.
0 commit comments