diff options
author | Felix Lange <fjl@twurst.com> | 2016-09-29 22:51:04 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2016-09-30 04:23:24 +0800 |
commit | ba8c4c6b1a3ee6740420ac264df1dbceaba4b555 (patch) | |
tree | e37e8f2a44dd498154bac4715e8a9d3ea7d370ec | |
parent | 4e8cec05abb567457e80185cb9fcf7ec2cc90596 (diff) | |
download | dexon-ba8c4c6b1a3ee6740420ac264df1dbceaba4b555.tar dexon-ba8c4c6b1a3ee6740420ac264df1dbceaba4b555.tar.gz dexon-ba8c4c6b1a3ee6740420ac264df1dbceaba4b555.tar.bz2 dexon-ba8c4c6b1a3ee6740420ac264df1dbceaba4b555.tar.lz dexon-ba8c4c6b1a3ee6740420ac264df1dbceaba4b555.tar.xz dexon-ba8c4c6b1a3ee6740420ac264df1dbceaba4b555.tar.zst dexon-ba8c4c6b1a3ee6740420ac264df1dbceaba4b555.zip |
trie: remove dependency on package crypto
Package crypto needs cgo, which is inconvenient for some build
configurations.
-rw-r--r-- | trie/trie.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/trie/trie.go b/trie/trie.go index 93e189e2e..55481f4f7 100644 --- a/trie/trie.go +++ b/trie/trie.go @@ -22,7 +22,7 @@ import ( "fmt" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/crypto/sha3" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" ) @@ -30,11 +30,14 @@ import ( var ( // This is the known root hash of an empty trie. emptyRoot = common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421") - // This is the known hash of an empty state trie entry. - emptyState = crypto.Keccak256Hash(nil) + emptyState common.Hash ) +func init() { + sha3.NewKeccak256().Sum(emptyState[:0]) +} + // Database must be implemented by backing stores for the trie. type Database interface { DatabaseWriter |