Skip to content

Commit

Permalink
making ReadTriesRootHash public
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangchiqing committed Oct 13, 2023
1 parent a49de37 commit d4731b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion ledger/complete/wal/checkpoint_v6_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
// ErrEOFNotReached for indicating end of file not reached error
var ErrEOFNotReached = errors.New("expect to reach EOF, but actually didn't")

var ReadTriesRootHash = readTriesRootHash

// readCheckpointV6 reads checkpoint file from a main file and 17 file parts.
// the main file stores:
// - version
Expand Down Expand Up @@ -632,7 +634,7 @@ func readTopLevelTries(dir string, fileName string, subtrieNodes [][]*node.Node,
return tries, nil
}

func readTriesRootHash(dir string, fileName string, logger zerolog.Logger) (
func readTriesRootHash(logger zerolog.Logger, dir string, fileName string) (
trieRoots []ledger.RootHash,
errToReturn error,
) {
Expand Down
4 changes: 2 additions & 2 deletions ledger/complete/wal/checkpoint_v6_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ func TestReadCheckpointRootHash(t *testing.T) {
logger := unittest.Logger()
require.NoErrorf(t, StoreCheckpointV6Concurrently(tries, dir, fileName, logger), "fail to store checkpoint")

trieRoots, err := readTriesRootHash(dir, fileName, logger)
trieRoots, err := readTriesRootHash(logger, dir, fileName)
require.NoError(t, err)
for i, root := range trieRoots {
expectedHash := tries[i].RootHash()
Expand All @@ -615,7 +615,7 @@ func TestReadCheckpointRootHashMulti(t *testing.T) {
logger := unittest.Logger()
require.NoErrorf(t, StoreCheckpointV6Concurrently(tries, dir, fileName, logger), "fail to store checkpoint")

trieRoots, err := readTriesRootHash(dir, fileName, logger)
trieRoots, err := readTriesRootHash(logger, dir, fileName)
require.NoError(t, err)
for i, root := range trieRoots {
expectedHash := tries[i].RootHash()
Expand Down

0 comments on commit d4731b9

Please sign in to comment.