@@ -28,9 +28,9 @@ import (
2828 "github.com/ethereum/go-ethereum/common"
2929 "github.com/ethereum/go-ethereum/core/types"
3030 "github.com/ethereum/go-ethereum/crypto"
31+ "github.com/ethereum/go-ethereum/crypto/keccak"
3132 "github.com/ethereum/go-ethereum/params"
3233 "github.com/ethereum/go-ethereum/rlp"
33- "golang.org/x/crypto/sha3"
3434)
3535
3636// Tests block header storage and retrieval operations.
@@ -52,10 +52,7 @@ func TestHeaderStorage(t *testing.T) {
5252 if entry := ReadHeaderRLP (db , header .Hash (), header .Number .Uint64 ()); entry == nil {
5353 t .Fatalf ("Stored header RLP not found" )
5454 } else {
55- hasher := sha3 .NewLegacyKeccak256 ()
56- hasher .Write (entry )
57-
58- if hash := common .BytesToHash (hasher .Sum (nil )); hash != header .Hash () {
55+ if hash := crypto .Keccak256Hash (entry ); hash != header .Hash () {
5956 t .Fatalf ("Retrieved RLP header mismatch: have %v, want %v" , entry , header )
6057 }
6158 }
@@ -72,8 +69,7 @@ func TestBodyStorage(t *testing.T) {
7269
7370 // Create a test body to move around the database and make sure it's really new
7471 body := & types.Body {Uncles : []* types.Header {{Extra : []byte ("test header" )}}}
75-
76- hasher := sha3 .NewLegacyKeccak256 ()
72+ hasher := keccak .NewLegacyKeccak256 ()
7773 rlp .Encode (hasher , body )
7874 hash := common .BytesToHash (hasher .Sum (nil ))
7975
@@ -90,10 +86,7 @@ func TestBodyStorage(t *testing.T) {
9086 if entry := ReadBodyRLP (db , hash , 0 ); entry == nil {
9187 t .Fatalf ("Stored body RLP not found" )
9288 } else {
93- hasher := sha3 .NewLegacyKeccak256 ()
94- hasher .Write (entry )
95-
96- if calc := common .BytesToHash (hasher .Sum (nil )); calc != hash {
89+ if calc := crypto .Keccak256Hash (entry ); calc != hash {
9790 t .Fatalf ("Retrieved RLP body mismatch: have %v, want %v" , entry , body )
9891 }
9992 }
0 commit comments