File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
beacon_node/beacon_chain/src
consensus/proto_array/src Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -900,7 +900,15 @@ where
900900 pub fn assert_knows_head ( & self , head_block_root : Hash256 ) {
901901 let heads = self . chain . heads ( ) . unwrap ( ) ;
902902 if !heads. iter ( ) . any ( |head| head. 0 == head_block_root) {
903- panic ! ( "Expected to known head block root {head_block_root:?}, known heads {heads:?}" ) ;
903+ let fork_choice = self . chain . canonical_head . fork_choice_read_lock ( ) ;
904+ if heads. is_empty ( ) {
905+ let nodes = fork_choice. proto_array ( ) . core_proto_array ( ) . nodes ;
906+ panic ! ( "Expected to known head block root {head_block_root:?}, but heads is empty. Nodes: {nodes:#?}" ) ;
907+ } else {
908+ panic ! (
909+ "Expected to known head block root {head_block_root:?}, known heads {heads:#?}"
910+ ) ;
911+ }
904912 }
905913 }
906914
Original file line number Diff line number Diff line change @@ -1062,6 +1062,9 @@ impl ProtoArray {
10621062 fn nodes_without_children ( & self ) -> Vec < usize > {
10631063 let mut childs_of = HashMap :: < _ , Vec < _ > > :: new ( ) ;
10641064 for ( index, node) in self . nodes . iter ( ) . enumerate ( ) {
1065+ // Create entry for this node
1066+ childs_of. entry ( index) . or_default ( ) ;
1067+ // Add this node to the parent's child list if any
10651068 if let Some ( parent_index) = node. parent {
10661069 childs_of. entry ( parent_index) . or_default ( ) . push ( index) ;
10671070 }
You can’t perform that action at this time.
0 commit comments