refactor block validate recordFailure func

This commit is contained in:
lanzafame 2020-08-28 17:11:59 +10:00
parent 050a0ec5e4
commit a24db6c584

View File

@ -263,8 +263,7 @@ func (bv *BlockValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub
stats.Record(ctx, metrics.BlockReceived.M(1))
recordFailure := func(what string) {
ctx, _ = tag.New(ctx, tag.Insert(metrics.FailureType, what))
stats.Record(ctx, metrics.BlockValidationFailure.M(1))
recordFailure(ctx, metrics.BlockValidationFailure, what)
bv.flagPeer(pid)
}