From 1edb65a45185eedaea07da58c66e8cff70fb7844 Mon Sep 17 00:00:00 2001 From: Giulio Date: Mon, 23 Dec 2024 17:14:32 +0100 Subject: [PATCH] save --- .../forkchoice/fork_graph/fork_graph_disk.go | 7 +++++-- cl/sentinel/sentinel.go | 19 +++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/cl/phase1/forkchoice/fork_graph/fork_graph_disk.go b/cl/phase1/forkchoice/fork_graph/fork_graph_disk.go index 92418688d19..73b291b1a1d 100644 --- a/cl/phase1/forkchoice/fork_graph/fork_graph_disk.go +++ b/cl/phase1/forkchoice/fork_graph/fork_graph_disk.go @@ -170,6 +170,9 @@ func (f *forkGraphDisk) AnchorSlot() uint64 { } func (f *forkGraphDisk) isBlockRootTheCurrentState(blockRoot libcommon.Hash) bool { + if f.currentState == nil { + return false + } blockRootState, _ := f.currentState.BlockRoot() return blockRoot == blockRootState } @@ -199,7 +202,7 @@ func (f *forkGraphDisk) AddChainSegment(signedBlock *cltypes.SignedBeaconBlock, } else { newState, err = f.getState(block.ParentRoot, false, true) if err != nil { - return nil, LogisticError, fmt.Errorf("AddChainSegment: %w, parentRoot; %x", err, block.ParentRoot) + return nil, LogisticError, fmt.Errorf("AddChainSegment: %w, parentRoot: %x", err, block.ParentRoot) } } @@ -262,7 +265,7 @@ func (f *forkGraphDisk) AddChainSegment(signedBlock *cltypes.SignedBeaconBlock, // Add block to list of invalid blocks log.Warn("Invalid beacon block", "slot", block.Slot, "blockRoot", blockRoot, "reason", invalidBlockErr) f.badBlocks.Store(libcommon.Hash(blockRoot), struct{}{}) - //f.currentState = nil + f.currentState = nil return nil, InvalidBlock, invalidBlockErr } diff --git a/cl/sentinel/sentinel.go b/cl/sentinel/sentinel.go index 8a0b94f85b3..4e6e13f2301 100644 --- a/cl/sentinel/sentinel.go +++ b/cl/sentinel/sentinel.go @@ -147,25 +147,20 @@ func (s *Sentinel) createListener() (*discover.UDPv5, error) { ) ip := net.ParseIP(ipAddr) - if ip.To4() == nil { - return nil, fmt.Errorf("IPV4 address not provided instead %s was provided", ipAddr) + if ip == nil { + return nil, fmt.Errorf("bad ip address provided, %s was provided", ipAddr) } var bindIP net.IP var networkVersion string - // check for our network version - switch { - // if we have 16 byte and 4 byte representation then we are in using udp6 - case ip.To16() != nil && ip.To4() == nil: - bindIP = net.IPv6zero - networkVersion = "udp6" - // only 4 bytes then we are using udp4 - case ip.To4() != nil: + // If the IP is an IPv4 address, bind to the correct zero address. + if ip.To4() != nil { bindIP = net.IPv4zero networkVersion = "udp4" - default: - return nil, fmt.Errorf("bad ip address provided, %s was provided", ipAddr) + } else { + bindIP = net.IPv6zero + networkVersion = "udp6" } udpAddr := &net.UDPAddr{