@@ -113,8 +113,8 @@ var (
113113 skeletonHeaderPrefix = []byte ("S" ) // skeletonHeaderPrefix + num (uint64 big endian) -> header
114114
115115 // Path-based storage scheme of merkle patricia trie.
116- trieNodeAccountPrefix = []byte ("A" ) // trieNodeAccountPrefix + hexPath -> trie node
117- trieNodeStoragePrefix = []byte ("O" ) // trieNodeStoragePrefix + accountHash + hexPath -> trie node
116+ TrieNodeAccountPrefix = []byte ("A" ) // TrieNodeAccountPrefix + hexPath -> trie node
117+ TrieNodeStoragePrefix = []byte ("O" ) // TrieNodeStoragePrefix + accountHash + hexPath -> trie node
118118 stateIDPrefix = []byte ("L" ) // stateIDPrefix + state root -> state id
119119
120120 PreimagePrefix = []byte ("secure-key-" ) // PreimagePrefix + hash -> preimage
@@ -265,15 +265,15 @@ func stateIDKey(root common.Hash) []byte {
265265 return append (stateIDPrefix , root .Bytes ()... )
266266}
267267
268- // accountTrieNodeKey = trieNodeAccountPrefix + nodePath.
268+ // accountTrieNodeKey = TrieNodeAccountPrefix + nodePath.
269269func accountTrieNodeKey (path []byte ) []byte {
270- return append (trieNodeAccountPrefix , path ... )
270+ return append (TrieNodeAccountPrefix , path ... )
271271}
272272
273- // storageTrieNodeKey = trieNodeStoragePrefix + accountHash + nodePath.
273+ // storageTrieNodeKey = TrieNodeStoragePrefix + accountHash + nodePath.
274274func storageTrieNodeKey (accountHash common.Hash , path []byte ) []byte {
275- buf := make ([]byte , len (trieNodeStoragePrefix )+ common .HashLength + len (path ))
276- n := copy (buf , trieNodeStoragePrefix )
275+ buf := make ([]byte , len (TrieNodeStoragePrefix )+ common .HashLength + len (path ))
276+ n := copy (buf , TrieNodeStoragePrefix )
277277 n += copy (buf [n :], accountHash .Bytes ())
278278 copy (buf [n :], path )
279279 return buf
@@ -294,16 +294,16 @@ func IsLegacyTrieNode(key []byte, val []byte) bool {
294294// account trie node in path-based state scheme, and returns the resolved
295295// node path if so.
296296func ResolveAccountTrieNodeKey (key []byte ) (bool , []byte ) {
297- if ! bytes .HasPrefix (key , trieNodeAccountPrefix ) {
297+ if ! bytes .HasPrefix (key , TrieNodeAccountPrefix ) {
298298 return false , nil
299299 }
300300 // The remaining key should only consist a hex node path
301301 // whose length is in the range 0 to 64 (64 is excluded
302302 // since leaves are always wrapped with shortNode).
303- if len (key ) >= len (trieNodeAccountPrefix )+ common .HashLength * 2 {
303+ if len (key ) >= len (TrieNodeAccountPrefix )+ common .HashLength * 2 {
304304 return false , nil
305305 }
306- return true , key [len (trieNodeAccountPrefix ):]
306+ return true , key [len (TrieNodeAccountPrefix ):]
307307}
308308
309309// IsAccountTrieNode reports whether a provided database entry is an account
@@ -317,20 +317,20 @@ func IsAccountTrieNode(key []byte) bool {
317317// trie node in path-based state scheme, and returns the resolved account hash
318318// and node path if so.
319319func ResolveStorageTrieNode (key []byte ) (bool , common.Hash , []byte ) {
320- if ! bytes .HasPrefix (key , trieNodeStoragePrefix ) {
320+ if ! bytes .HasPrefix (key , TrieNodeStoragePrefix ) {
321321 return false , common.Hash {}, nil
322322 }
323323 // The remaining key consists of 2 parts:
324324 // - 32 bytes account hash
325325 // - hex node path whose length is in the range 0 to 64
326- if len (key ) < len (trieNodeStoragePrefix )+ common .HashLength {
326+ if len (key ) < len (TrieNodeStoragePrefix )+ common .HashLength {
327327 return false , common.Hash {}, nil
328328 }
329- if len (key ) >= len (trieNodeStoragePrefix )+ common .HashLength + common .HashLength * 2 {
329+ if len (key ) >= len (TrieNodeStoragePrefix )+ common .HashLength + common .HashLength * 2 {
330330 return false , common.Hash {}, nil
331331 }
332- accountHash := common .BytesToHash (key [len (trieNodeStoragePrefix ) : len (trieNodeStoragePrefix )+ common .HashLength ])
333- return true , accountHash , key [len (trieNodeStoragePrefix )+ common .HashLength :]
332+ accountHash := common .BytesToHash (key [len (TrieNodeStoragePrefix ) : len (TrieNodeStoragePrefix )+ common .HashLength ])
333+ return true , accountHash , key [len (TrieNodeStoragePrefix )+ common .HashLength :]
334334}
335335
336336// IsStorageTrieNode reports whether a provided database entry is a storage
0 commit comments