Open GalRogozinski opened 6 years ago
The diff
map, coupled with approvedHashes
should be a part of tip selection - if it is desired for the new selected tip to be consistent with the selected tip of the previous run - in the case of multiple tip selection, and in the case where a model tip is first selected.
It will be. It is a design issue. I want WalkValidator
to become an "application service", thus void of state.
Another problem of WalkValidator
not a being dependency of TipSelector
is that it can't be easily mocked for unit tests.
Description
In the current implementation WalkValidator holds the ledger
diff
map (the addresses that have their state changed) and a set of a approved transactions that came from a previous walk. This object shouldn't hold those fields.See: https://github.com/iotaledger/iri/blob/dev/src/main/java/com/iota/iri/service/tipselection/impl/WalkValidatorImpl.java#L38-L39
Motivation
Maintainability of the code. This object should be part of the business logic layer. Since it is not stateful it will be thread-safe (as long as we won't pass the same diff maps on different threads). It will also make it easier to inject it in the correct layers to objects that it will depend on.
Requirements
diff
map andapprovedHashes
shouldn't be fields of any business logic object.WalkerValidator
should be injected fromIOTA.class
toTipSelector
Am I planning to do it myself with a PR?
Until I am not the assignee, anyone can assign this issue to himself/herself.