Skip to content

Commit

Permalink
Don't compute the unused ephemeral nodes (#2579)
Browse files Browse the repository at this point in the history
  • Loading branch information
pav-kv authored Jul 19, 2021
1 parent 712722d commit 65021e5
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 9 deletions.
4 changes: 0 additions & 4 deletions storage/cache/log_tile.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ func PopulateLogTile(st *storagepb.SubtreeProto, hasher hashers.LogHasher) error
return err
}
}
_, err := cr.GetRootHash(store)
if err != nil {
return fmt.Errorf("failed to compute root hash: %v", err)
}

// Additional check - after population we should have the same number of internal nodes
// as before the subtree was written to storage. Either because they were loaded from
Expand Down
4 changes: 0 additions & 4 deletions storage/mysql/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,6 @@ func createLogNodesForTreeAtSize(t *testing.T, ts, rev int64) ([]stree.Node, err
return nil, err
}
}
// Store the ephemeral nodes as well.
if _, err := cr.GetRootHash(store); err != nil {
return nil, err
}

// Unroll the map, which has deduped the updates for us and retained the latest
nodes := make([]stree.Node, 0, len(nodeMap))
Expand Down
2 changes: 1 addition & 1 deletion storage/testonly/fake_node_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func NewMultiFakeNodeReaderFromLeaves(batches []LeafBatch) *MultiFakeNodeReader
}
}
// TODO(pavelkalinnikov): Use testing.T.Fatalf instead of panics.
root, err := cr.GetRootHash(store) // Store the ephemeral nodes as well.
root, err := cr.GetRootHash(nil)
if err != nil {
panic(fmt.Errorf("GetRootHash: %v", err))
}
Expand Down

0 comments on commit 65021e5

Please sign in to comment.