Skip to content

Commit ba8c4c6

Browse files
committed
trie: remove dependency on package crypto
Package crypto needs cgo, which is inconvenient for some build configurations.
1 parent 4e8cec0 commit ba8c4c6

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎trie/trie.go‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,22 @@ import (
2222
"fmt"
2323

2424
"github.com/ethereum/go-ethereum/common"
25-
"github.com/ethereum/go-ethereum/crypto"
25+
"github.com/ethereum/go-ethereum/crypto/sha3"
2626
"github.com/ethereum/go-ethereum/logger"
2727
"github.com/ethereum/go-ethereum/logger/glog"
2828
)
2929

3030
var (
3131
// This is the known root hash of an empty trie.
3232
emptyRoot = common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
33-
3433
// This is the known hash of an empty state trie entry.
35-
emptyState = crypto.Keccak256Hash(nil)
34+
emptyState common.Hash
3635
)
3736

37+
func init() {
38+
sha3.NewKeccak256().Sum(emptyState[:0])
39+
}
40+
3841
// Database must be implemented by backing stores for the trie.
3942
type Database interface {
4043
DatabaseWriter

0 commit comments

Comments
 (0)