dtr-org / unit-e

A digital currency for a new era of decentralized trust
https://unit-e.io
MIT License
45 stars 15 forks source link

Simplify BlockValidationResult #1098

Closed scravy closed 5 years ago

scravy commented 5 years ago

This changes BlockValidationResult from hosting a set of validation errors to just carry one validation error and always short circuit / return early on validation errors.

This was already suggested during the initial review of this by @kostyantyn

Some things that follow: Some tests had to be set up a bit differently as previously multiple things could fail, now the first thing fails and some fixtures were not mocked accordingly. This fixes that.

Cosmetic changes:

Signed-off-by: Julian Fleischer julian@thirdhash.com

scravy commented 5 years ago

But BlockValidationResult seems to be one step away from being replaced by enum.

@Nizametdinov I am planning to have ValidationError from validation_error.cpp, BlockValidationResult, and BlockValidationError merged in one class; but for now I did not go that far as I have a series of dependent pull requests (to come). Also this pull requests mostly deals with the change from set to early return one error only and I would like to keep the changeset to it.

castarco commented 5 years ago

Concept ACK 468283980c1ceff5c9b3b291658dae2ada659b16