Skip to content

Commit

Permalink
Propagate Log Update Failures in AddSequencedLeaves (#1544)
Browse files Browse the repository at this point in the history
* Propagate Log Update Failures in AddSequencedLeaves

* Update log_client.go

* Update client/log_client.go

Co-Authored-By: therealdrake <alexdrake@google.com>

* Update client/log_client.go

Co-Authored-By: therealdrake <alexdrake@google.com>

Co-authored-by: Gary Belvin <gdbelvin@gmail.com>
  • Loading branch information
therealdrake and gdbelvin authored May 26, 2022
1 parent 49b25e4 commit 5a7ccac
Showing 1 changed file with 6 additions and 1 deletion.
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() {
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

0 comments on commit 5a7ccac

Please sign in to comment.