Skip to content

Commit de54914

Browse files
authored
Merge pull request #2017 from CortexFoundation/dev
crypto instead of sha3
2 parents 64496e3 + 84cf67a commit de54914

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

ctxc/downloader/statesync.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"github.com/CortexFoundation/CortexTheseus/ctxcdb"
2929
"github.com/CortexFoundation/CortexTheseus/log"
3030
"github.com/CortexFoundation/CortexTheseus/trie"
31-
"golang.org/x/crypto/sha3"
3231
)
3332

3433
// stateReq represents a batch of state fetch requests grouped tocortexer into
@@ -300,7 +299,7 @@ func newStateSync(d *Downloader, root common.Hash) *stateSync {
300299
return &stateSync{
301300
d: d,
302301
sched: state.NewStateSync(root, d.stateDB, d.stateBloom),
303-
keccak: sha3.NewLegacyKeccak256().(crypto.KeccakState),
302+
keccak: crypto.NewKeccakState(),
304303
trieTasks: make(map[common.Hash]*trieTask),
305304
codeTasks: make(map[common.Hash]*codeTask),
306305
deliver: make(chan *stateReq),

ctxc/handler.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ import (
4242
"github.com/CortexFoundation/CortexTheseus/params"
4343
"github.com/CortexFoundation/CortexTheseus/rlp"
4444
"github.com/CortexFoundation/CortexTheseus/trie"
45-
46-
"golang.org/x/crypto/sha3"
4745
)
4846

4947
const (
@@ -990,7 +988,7 @@ func (pm *ProtocolManager) BroadcastTransactions(txs types.Transactions) {
990988

991989
var (
992990
signer = types.LatestSignerForChainID(pm.blockchain.Config().ChainID) // Don't care about chain status, we just need *a* sender
993-
hasher = sha3.NewLegacyKeccak256().(crypto.KeccakState)
991+
hasher = crypto.NewKeccakState()
994992
hash = make([]byte, 32)
995993
)
996994
for _, tx := range txs {

trie/hasher.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121

2222
"github.com/CortexFoundation/CortexTheseus/crypto"
2323
"github.com/CortexFoundation/CortexTheseus/rlp"
24-
"golang.org/x/crypto/sha3"
2524
)
2625

2726
// hasher is a type used for the trie Hash operation. A hasher has some
@@ -38,7 +37,7 @@ var hasherPool = sync.Pool{
3837
New: func() any {
3938
return &hasher{
4039
tmp: make([]byte, 0, 550), // cap is as large as a full fullNode.
41-
sha: sha3.NewLegacyKeccak256().(crypto.KeccakState),
40+
sha: crypto.NewKeccakState(),
4241
encbuf: rlp.NewEncoderBuffer(nil),
4342
}
4443
},

0 commit comments

Comments
 (0)