Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a few revert tests #23

Merged
merged 9 commits into from
Apr 15, 2024
6 changes: 1 addition & 5 deletions cmd/explored/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,7 @@ func newNode(addr, dir string, chainNetwork string, useUPNP bool, logger *zap.Lo
return nil, err
}

genesisIndex := types.ChainIndex{
ID: genesisBlock.ID(),
Height: 0,
}
e, err := explorer.NewExplorer(cm, store, genesisIndex, logger.Named("explorer"))
e, err := explorer.NewExplorer(cm, store, logger.Named("explorer"))
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions explorer/explorer.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ func syncStore(store Store, cm ChainManager, index types.ChainIndex) error {
}

// NewExplorer returns a Sia explorer.
func NewExplorer(cm ChainManager, store Store, genesisIndex types.ChainIndex, log *zap.Logger) (*Explorer, error) {
func NewExplorer(cm ChainManager, store Store, log *zap.Logger) (*Explorer, error) {
e := &Explorer{s: store}

tip, err := store.Tip()
if errors.Is(err, ErrNoTip) {
tip = genesisIndex
tip = types.ChainIndex{}
} else if err != nil {
return nil, fmt.Errorf("failed to get tip: %w", err)
}
Expand All @@ -91,7 +91,7 @@ func NewExplorer(cm ChainManager, store Store, genesisIndex types.ChainIndex, lo
e.mu.Lock()
lastTip, err := store.Tip()
if errors.Is(err, ErrNoTip) {
lastTip = genesisIndex
lastTip = types.ChainIndex{}
} else if err != nil {
log.Error("failed to get tip", zap.Error(err))
}
Expand Down
Loading
Loading