core/types: prealloc map in HashDifference as in TxDifference (#32946)

This commit is contained in:
cui 2025-10-20 10:35:14 +08:00 committed by Alvarez
parent 5af34cc223
commit 4b85736c8d

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{}{}
} }