From 7cf8c891ca6445683e0c6b981379ee27a44daedc Mon Sep 17 00:00:00 2001 From: CPerezz Date: Wed, 8 Apr 2026 12:12:53 +0200 Subject: [PATCH] trie/bintrie: drop redundant zeroBlob local in DeleteAccount MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The package already declares `var zero [32]byte` in binary_node.go, and both GetAccount and UpdateAccount reference `zero[:]` directly. The PR-introduced `zeroBlob` mirrored the older shadowing pattern from DeleteStorage but is unnecessary here — drop it and reuse the package-level value to match the canonical style on the create side. --- trie/bintrie/trie.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/trie/bintrie/trie.go b/trie/bintrie/trie.go index 6e965db0e0..be9f3d47ab 100644 --- a/trie/bintrie/trie.go +++ b/trie/bintrie/trie.go @@ -317,17 +317,16 @@ func (t *BinaryTrie) UpdateStorage(address common.Address, key, value []byte) er // enumerate every slot of a given account. func (t *BinaryTrie) DeleteAccount(addr common.Address) error { var ( - zeroBlob [HashSize]byte - values = make([][]byte, StemNodeWidth) - stem = GetBinaryTreeKey(addr, zero[:]) + values = make([][]byte, StemNodeWidth) + stem = GetBinaryTreeKey(addr, zero[:]) ) // Clear BasicData (nonce, balance, code size) and CodeHash. - values[BasicDataLeafKey] = zeroBlob[:] - values[CodeHashLeafKey] = zeroBlob[:] + values[BasicDataLeafKey] = zero[:] + values[CodeHashLeafKey] = zero[:] // Write a non-nil 32-byte sentinel at the deletion marker offset so // GetAccount can tell "deleted" apart from "never existed" on a // subsequent read. See GetAccount's deletion branch around trie.go:219. - values[accountDeletedMarkerKey] = zeroBlob[:] + values[accountDeletedMarkerKey] = zero[:] root, err := t.root.InsertValuesAtStem(stem, values, t.nodeResolver, 0) if err != nil {