misc
This commit is contained in:
parent
6969595d37
commit
5b0cc124a5
@ -85,13 +85,12 @@ type SnapshotParams struct {
|
||||
func (s *Service) CreateSnapshot(params SnapshotParams) error {
|
||||
// extract header from lvldb and publish to PG-IPFS
|
||||
// hold onto the headerID so that we can link the state nodes to this header
|
||||
log.Infof("Creating snapshot at height %d", params.Height)
|
||||
hash := rawdb.ReadCanonicalHash(s.ethDB, params.Height)
|
||||
header := rawdb.ReadHeader(s.ethDB, hash, params.Height)
|
||||
if header == nil {
|
||||
return fmt.Errorf("unable to read canonical header at height %d", params.Height)
|
||||
}
|
||||
log.Infof("head hash: %s head height: %d", hash.Hex(), params.Height)
|
||||
log.Info("Creating snapshot", "height", params.Height, "hash", hash)
|
||||
|
||||
// Context for snapshot work
|
||||
ctx, cancelCtx := context.WithCancel(context.Background())
|
||||
@ -157,7 +156,7 @@ func (s *Service) CreateLatestSnapshot(workers uint, watchedAddresses []common.A
|
||||
hash := rawdb.ReadHeadHeaderHash(s.ethDB)
|
||||
height := rawdb.ReadHeaderNumber(s.ethDB, hash)
|
||||
if height == nil {
|
||||
return fmt.Errorf("unable to read header height for header hash %s", hash.String())
|
||||
return fmt.Errorf("unable to read header height for header hash %s", hash)
|
||||
}
|
||||
return s.CreateSnapshot(SnapshotParams{Height: *height, Workers: workers, WatchedAddresses: watchedAddresses})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user