Skip to content

Commit

Permalink
Removed nil check that is no longer needed to satisfy test
Browse files Browse the repository at this point in the history
Test was updated in google#3244 to test the correct behaviour, which means that we don't need to worry here about whether the tree exists or not.
  • Loading branch information
mhutchinson committed Dec 11, 2023
1 parent a89fbbe commit 0e02c59
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions storage/mysql/tree_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,11 @@ func (m *mySQLTreeStorage) beginTreeTx(ctx context.Context, tree *trillian.Tree,
return treeTX{}, err
}
var subtreeRevisions bool
if tree.StorageSettings != nil {
// This nil check always passes when we have read the tree from the database.
// This check avoids a weird test case in logtests.go that uses an uninitialized tree.
// TODO(mhutchinson): can the test be changed, or is this uninitialized case legit?
o := &mysqlpb.StorageOptions{}
if err := anypb.UnmarshalTo(tree.StorageSettings, o, proto.UnmarshalOptions{}); err != nil {
return treeTX{}, fmt.Errorf("failed to unmarshal StorageSettings: %v", err)
}
subtreeRevisions = o.SubtreeRevisions
o := &mysqlpb.StorageOptions{}
if err := anypb.UnmarshalTo(tree.StorageSettings, o, proto.UnmarshalOptions{}); err != nil {
return treeTX{}, fmt.Errorf("failed to unmarshal StorageSettings: %v", err)
}
subtreeRevisions = o.SubtreeRevisions
return treeTX{
tx: t,
mu: &sync.Mutex{},
Expand Down

0 comments on commit 0e02c59

Please sign in to comment.