Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merkledb style nits #2783

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion x/merkledb/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (proof *Proof) Verify(ctx context.Context, expectedRootID ids.ID, tokenSize
// Insert all proof nodes.
// [provenKey] is the key that we are proving exists, or the key
// that is the next key along the node path, proving that [proof.Key] doesn't exist in the trie.
provenKey := maybe.Some(proof.Path[len(proof.Path)-1].Key)
provenKey := maybe.Some(lastNode.Key)
Copy link
Author

@danlaine danlaine Feb 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semantically the same as before as we do this above:

lastNode := proof.Path[len(proof.Path)-1]


if err = addPathInfo(view, proof.Path, provenKey, provenKey); err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions x/merkledb/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ func (v *view) calculateNodeIDsHelper(n *node) ids.ID {
// We use [wg] to wait until all descendants of [n] have been updated.
var wg sync.WaitGroup

for childIndex := range n.children {
childEntry := n.children[childIndex]
for childIndex, childEntry := range n.children {
childEntry := childEntry // New variable so goroutine doesn't capture loop variable.
abi87 marked this conversation as resolved.
Show resolved Hide resolved
childKey := n.key.Extend(ToToken(childIndex, v.tokenSize), childEntry.compressedKey)
childNodeChange, ok := v.changes.nodes[childKey]
if !ok {
Expand Down
Loading