core/types: prealloc map in HashDifference as in TxDifference

This commit is contained in:
cuiweixie 2025-10-18 20:03:12 +08:00
parent 0ec63272bf
commit 5ba6aed7c9
No known key found for this signature in database
GPG key ID: 16DF64EE15E495A3

View file

@ -648,7 +648,7 @@ func TxDifference(a, b Transactions) Transactions {
func HashDifference(a, b []common.Hash) []common.Hash { func HashDifference(a, b []common.Hash) []common.Hash {
keep := make([]common.Hash, 0, len(a)) keep := make([]common.Hash, 0, len(a))
remove := make(map[common.Hash]struct{}) remove := make(map[common.Hash]struct{}, len(b))
for _, hash := range b { for _, hash := range b {
remove[hash] = struct{}{} remove[hash] = struct{}{}
} }