mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 19:30:44 +00:00
touch-ups
This commit is contained in:
parent
223b5bcff4
commit
eda6bc43ec
3 changed files with 6 additions and 5 deletions
|
|
@ -114,7 +114,7 @@ type Era interface {
|
|||
Accumulator() (common.Hash, error)
|
||||
}
|
||||
|
||||
// ReadDir reads all the era1 files in a directory for a given network.
|
||||
// ReadDir reads all the era files in a directory for a given network.
|
||||
// Format: <network>-<epoch>-<hexroot>.erae or <network>-<epoch>-<hexroot>.era1
|
||||
func ReadDir(dir, network string) ([]string, error) {
|
||||
entries, err := os.ReadDir(dir)
|
||||
|
|
@ -137,7 +137,7 @@ func ReadDir(dir, network string) ([]string, error) {
|
|||
}
|
||||
parts := strings.Split(entry.Name(), "-")
|
||||
if len(parts) != 3 || parts[0] != network {
|
||||
// Invalid era1 filename, skip.
|
||||
// Invalid era filename, skip.
|
||||
continue
|
||||
}
|
||||
if epoch, err := strconv.ParseUint(parts[1], 10, 64); err != nil {
|
||||
|
|
|
|||
|
|
@ -251,6 +251,7 @@ func (e *Era) headerOff(num uint64) (int64, error) { return e.indexOffset(num,
|
|||
func (e *Era) bodyOff(num uint64) (int64, error) { return e.indexOffset(num, body) }
|
||||
func (e *Era) receiptOff(num uint64) (int64, error) { return e.indexOffset(num, receipts) }
|
||||
func (e *Era) tdOff(num uint64) (int64, error) { return e.indexOffset(num, td) }
|
||||
func (e *Era) proofOff(num uint64) (int64, error) { return e.indexOffset(num, proof) }
|
||||
|
||||
// indexOffset calculates offset to a certain component for a block number within a file.
|
||||
func (e *Era) indexOffset(n uint64, component componentType) (int64, error) {
|
||||
|
|
@ -286,7 +287,7 @@ type metadata struct {
|
|||
// componentType represents the integer form of a specific type that can be present in the era file.
|
||||
type componentType int
|
||||
|
||||
// TypeCompressedHeader, TypeCompressedBody, TypeCompressedReceipts, TypeTotalDifficulty, and TypeProof are the different types of components that can be present in the era file.
|
||||
// header, body, receipts, td, and proof are the different types of components that can be present in the era file.
|
||||
const (
|
||||
header componentType = iota
|
||||
body
|
||||
|
|
|
|||
|
|
@ -31,6 +31,6 @@ const (
|
|||
// It's a stub for later integration into Era.
|
||||
type Proof interface {
|
||||
EncodeRLP(w io.Writer) error
|
||||
DecodeRlP(s *rlp.Stream) error
|
||||
DecodeRLP(s *rlp.Stream) error
|
||||
Variant() ProofVariant
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue