Skip to content

Commit

Permalink
ugly but catches them all
Browse files Browse the repository at this point in the history
  • Loading branch information
ramin committed Jan 4, 2024
1 parent cb42d92 commit 0ebef4a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions verifier/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ func (v *Verifier) AwaitBlock(ctx context.Context) <-chan *header.ExtendedHeader
heights, err := v.rpc.Header.Subscribe(ctx)
if err != nil {
v.errCh <- err
v.Metrics.Errors.Add(ctx, 1)
if v.Metrics != nil {
v.Metrics.Errors.Add(ctx, 1)
}
panic(err)
}

Expand All @@ -55,19 +57,27 @@ func (v *Verifier) WriteToBlock(ctx context.Context, height uint64) uint64 {
writeBlob, err := generator.NewBlob()
if err != nil {
v.errCh <- err
v.Metrics.Errors.Add(ctx, 1)
if v.Metrics != nil {
v.Metrics.Errors.Add(ctx, 1)
}
}

writeHeight, err := v.rpc.Blob.Submit(ctx, []*blob.Blob{writeBlob}, nil)
if err != nil {
v.errCh <- err
logrus.Info(err)
logrus.Error("failed to wrote blob to block ", writeHeight)
v.Metrics.Errors.Add(ctx, 1)

if v.Metrics != nil {
v.Metrics.Errors.Add(ctx, 1)
}
return writeHeight
}

v.Metrics.Writes.Add(context.Background(), 1)
if v.Metrics != nil {
v.Metrics.Writes.Add(context.Background(), 1)
}

logrus.Info("wrote blob to block ", writeHeight)

v.History.Logs[fmt.Sprintf("%v", writeHeight)] = DataLog{
Expand Down

0 comments on commit 0ebef4a

Please sign in to comment.