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

Harden Active Chain Component #897

Closed scravy closed 5 years ago

scravy commented 5 years ago

During debugging I ran into some corner cases which these changes should help to identify.

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

frolosofsky commented 5 years ago

Can we see these warnings in normally running nodes? If not I suggest convert them in assertions.

scravy commented 5 years ago

Can we see these warnings in normally running nodes? If not I suggest convert them in assertions.

Yes.

frolosofsky commented 5 years ago

Yes.

Then, if it's a "normal" scenario, why is it a warning? As a user I will worry to see warnings.

scravy commented 5 years ago

Then, if it's a "normal" scenario, why is it a warning? As a user I will worry to see warnings.

Okay: https://github.com/dtr-org/unit-e/pull/897/commits/2a2db3f46a950556d1249f1807814b26dbc1bbcd

scravy commented 5 years ago

Putting these exceptions (assert would have the same effect) breaks like a third of the tests.

scravy commented 5 years ago

GetTip() is used in a number of places where it is being invoked while we're still in IBD, mostly in validation/finalization logic. These places obviously expect to get a nullptr returned as they guard against that. Anyways, putting an assertion or throwing in this case breaks the code. So I've limited that and documented which function expects what.

scravy commented 5 years ago

@frolosofsky please re-review.