add guard
This commit is contained in:
parent
da0157a64b
commit
367a9b4577
@ -67,6 +67,9 @@ func (s *Service) CreateSnapshot(height uint64) error {
|
|||||||
logrus.Infof("Creating snapshot at height %d", height)
|
logrus.Infof("Creating snapshot at height %d", height)
|
||||||
hash := rawdb.ReadCanonicalHash(s.ethDB, height)
|
hash := rawdb.ReadCanonicalHash(s.ethDB, height)
|
||||||
header := rawdb.ReadHeader(s.ethDB, hash, height)
|
header := rawdb.ReadHeader(s.ethDB, hash, height)
|
||||||
|
if header == nil {
|
||||||
|
return fmt.Errorf("unable to read canonical header at height %d", height)
|
||||||
|
}
|
||||||
headerID, err := s.ipfsPublisher.PublishHeader(header)
|
headerID, err := s.ipfsPublisher.PublishHeader(header)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user