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

Propagate Log Update Failures in AddSequencedLeaves #1544

Merged
merged 4 commits into from
May 26, 2022
Merged
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
7 changes: 6 additions & 1 deletion client/log_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,15 @@ func (c *LogClient) AddSequencedLeaves(ctx context.Context, dataByIndex map[int6
leaf.LeafIndex = index
leaves = append(leaves, leaf)
}
_, err := c.client.AddSequencedLeaves(ctx, &trillian.AddSequencedLeavesRequest{
resp, err := c.client.AddSequencedLeaves(ctx, &trillian.AddSequencedLeavesRequest{
LogId: c.LogID,
Leaves: leaves,
})
for _, leaf := range resp.GetResults() {
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the client doesn't get to find out which leaves already exist. Maybe that doesn't matter.

if s := status.FromProto(leaf.GetStatus()); s.Code() != codes.OK && s.Code() != codes.AlreadyExists {
return status.Errorf(s.Code(), "unexpected fail status in AddSequencedLeaves: %+v, err: %v", leaf, s.Message())
}
}
return err
}

Expand Down