Skip to content

Commit

Permalink
Merge pull request #23 from SiaFoundation/add-revert-tests
Browse files Browse the repository at this point in the history
Add a few revert tests
  • Loading branch information
n8maninger authored Apr 15, 2024
2 parents 42441e0 + 05bb040 commit abe0200
Show file tree
Hide file tree
Showing 6 changed files with 939 additions and 113 deletions.
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

0 comments on commit abe0200

Please sign in to comment.