Skip to content

Commit 095523e

Browse files
Update index.md
Update remaininingcode blocks of Merkle Patricia Trie Documentation for better understanding.
1 parent bb7b415 commit 095523e

File tree

1 file changed

+6
-6
lines changed
  • public/content/developers/docs/data-structures-and-encoding/patricia-merkle-trie

1 file changed

+6
-6
lines changed

public/content/developers/docs/data-structures-and-encoding/patricia-merkle-trie/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ Examples:
137137
Here is the extended code for getting a node in the Merkle Patricia trie:
138138

139139
```
140-
def get_helper(node,path):
141-
if path == []: return node
142-
if node = '': return ''
143-
curnode = rlp.decode(node if len(node) < 32 else db.get(node))
140+
def get_helper(node_hash,path):
141+
if path == []: return node_hash
142+
if node_hash == '': return ''
143+
curnode = rlp.decode(node_hash if len(node_hash) < 32 else db.get(node_hash))
144144
if len(curnode) == 2:
145145
(k2, v2) = curnode
146146
k2 = compact_decode(k2)
@@ -151,13 +151,13 @@ Here is the extended code for getting a node in the Merkle Patricia trie:
151151
elif len(curnode) == 17:
152152
return get_helper(curnode[path[0]],path[1:])
153153
154-
def get(node,path):
154+
def get(node_hash,path):
155155
path2 = []
156156
for i in range(len(path)):
157157
path2.push(int(ord(path[i]) / 16))
158158
path2.push(ord(path[i]) % 16)
159159
path2.push(16)
160-
return get_helper(node,path2)
160+
return get_helper(node_hash,path2)
161161
```
162162

163163
### Example Trie {#example-trie}

0 commit comments

Comments
 (0)