Scorex
Scorex copied to clipboard
Persistent modifier validation improvement
Now we have quite flat validation algorithm for persistent modifiers - it does many checks in one step, this leads to impossiblity of handling all validation-failure cases properly. For example, if we're trying to validate block section (S) for some header (H) and validation fails at the first step then there are few cases which further application handling depends on:
-
Sdoes not really relates toH- so we should just invalidateS -
Srelates toHbut was malformed - here we should invalidateSand alsoHCurrent validation implementation in Scorex does not allow to distinguish case 1 and 2. https://github.com/ScorexFoundation/Scorex/blob/8adeddbaba7a49e0614f7df7de31fcaf73a263de/src/main/scala/scorex/core/NodeViewHolder.scala#L268
Possible solution could be to subscribe to SyntacticallyFailedModification(S), check if some S relates to H it refers to, and then invalidate H.
@oskin1 what changes to Scorex you are proposing?