Skip to content

Commit

Permalink
Complete TODO (#1632)
Browse files Browse the repository at this point in the history
  • Loading branch information
pav-kv authored May 23, 2019
1 parent 580ab86 commit 238b30d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions log/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,6 @@ func (s Sequencer) prepareLeaves(leaves []*trillian.LogLeaf, begin int64, label
// updateCompactTree adds the passed in leaves to the compact tree. Returns a
// map of all updated tree nodes, and the new root hash.
func (s Sequencer) updateCompactTree(mt *compact.Tree, leaves []*trillian.LogLeaf, label string) (map[compact.NodeID][]byte, []byte, error) {
// TODO(pavelkalinnikov): Move this call to IntegrateBatch when gocyclo is
// happy with the function complexity.
if err := s.prepareLeaves(leaves, mt.Size(), label); err != nil {
return nil, nil, err
}

nodeMap := make(map[compact.NodeID][]byte)
store := func(id compact.NodeID, hash []byte) { nodeMap[id] = hash }

Expand Down Expand Up @@ -399,6 +393,9 @@ func (s Sequencer) IntegrateBatch(ctx context.Context, tree *trillian.Tree, limi
}

// Collate node updates.
if err := s.prepareLeaves(sequencedLeaves, merkleTree.Size(), label); err != nil {
return err
}
nodeMap, newRoot, err := s.updateCompactTree(merkleTree, sequencedLeaves, label)
if err != nil {
return err
Expand Down

0 comments on commit 238b30d

Please sign in to comment.