Skip to content

Commit

Permalink
Log errors in ReadKnot
Browse files Browse the repository at this point in the history
  • Loading branch information
jdowning100 committed Feb 24, 2023
1 parent 58b5f7e commit 0c39f1f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/knot.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/dominant-strategies/go-quai/common"
"github.com/dominant-strategies/go-quai/core/types"
"github.com/dominant-strategies/go-quai/log"
"github.com/dominant-strategies/go-quai/rlp"
"github.com/dominant-strategies/go-quai/trie"
)
Expand All @@ -17,12 +18,14 @@ func ReadKnot(chainfile string) []*types.Block {
// Load chain.rlp.
fh, err := os.Open(chainfile)
if err != nil {
log.Error("Error in ReadKnot", "Err", err)
return nil
}
defer fh.Close()
var reader io.Reader = fh
if strings.HasSuffix(chainfile, ".gz") {
if reader, err = gzip.NewReader(reader); err != nil {
log.Error("Error in ReadKnot", "Err", err)
return nil
}
}
Expand All @@ -33,6 +36,7 @@ func ReadKnot(chainfile string) []*types.Block {
if err := stream.Decode(b); err == io.EOF {
break
} else if err != nil {
log.Error("Error in ReadKnot", "Err", err)
return nil
}
h := b.Header()
Expand Down

0 comments on commit 0c39f1f

Please sign in to comment.