@@ -2054,29 +2054,24 @@ func (s *Server) GetGenesis(w http.ResponseWriter, r *http.Request) {
2054
2054
// GetDepositSnapshot retrieves the EIP-4881 Deposit Tree Snapshot. Either a JSON or,
2055
2055
// if the Accept header was added, bytes serialized by SSZ will be returned.
2056
2056
func (s * Server ) GetDepositSnapshot (w http.ResponseWriter , r * http.Request ) {
2057
- ctx , span := trace .StartSpan (r .Context (), "beacon.GetDepositSnapshot" )
2057
+ _ , span := trace .StartSpan (r .Context (), "beacon.GetDepositSnapshot" )
2058
2058
defer span .End ()
2059
2059
2060
- if s .BeaconDB == nil {
2061
- httputil .HandleError (w , "Could not retrieve beaconDB" , http .StatusInternalServerError )
2062
- return
2063
- }
2064
- eth1data , err := s .BeaconDB .ExecutionChainData (ctx )
2060
+ snapshot , err := s .DepositFetcher .Snapshot ()
2065
2061
if err != nil {
2066
- httputil .HandleError (w , "Could not retrieve execution chain data: " + err .Error (), http .StatusInternalServerError )
2067
- return
2068
- }
2069
- if eth1data == nil {
2070
- httputil .HandleError (w , "Could not retrieve execution chain data: empty Eth1Data" , http .StatusInternalServerError )
2062
+ httputil .HandleError (w , "Could not retrieve snapshot: " + err .Error (), http .StatusInternalServerError )
2071
2063
return
2072
2064
}
2073
- snapshot := eth1data .DepositSnapshot
2074
2065
if snapshot == nil || len (snapshot .Finalized ) == 0 {
2075
- httputil .HandleError (w , "No Finalized Snapshot Available " , http .StatusNotFound )
2066
+ httputil .HandleError (w , "Could not retrieve snapshot: empty snapshot " , http .StatusInternalServerError )
2076
2067
return
2077
2068
}
2078
2069
if len (snapshot .Finalized ) > depositsnapshot .DepositContractDepth {
2079
- httputil .HandleError (w , "Retrieved invalid deposit snapshot" , http .StatusInternalServerError )
2070
+ httputil .HandleError (
2071
+ w ,
2072
+ fmt .Sprintf ("Snapshot depth %d bigger than deposit contract depth %d" , len (snapshot .Finalized ), depositsnapshot .DepositContractDepth ),
2073
+ http .StatusInternalServerError ,
2074
+ )
2080
2075
return
2081
2076
}
2082
2077
if httputil .RespondWithSsz (r ) {
0 commit comments