forked from comit-network/xmr-btc-swap
-
Notifications
You must be signed in to change notification settings - Fork 46
Refactor states #929
Copy link
Copy link
Open
Labels
AliceRelated to the maker state machineRelated to the maker state machineBobRelated to the taker state machineRelated to the taker state machinerefactoringRelated to refactorings. No new features are added.Related to refactorings. No new features are added.
Metadata
Metadata
Assignees
Labels
AliceRelated to the maker state machineRelated to the maker state machineBobRelated to the taker state machineRelated to the taker state machinerefactoringRelated to refactorings. No new features are added.Related to refactorings. No new features are added.
Current approach:
This frequently leads to situations where we can't (easily) do something in a later state because we can't (easily) access the information even though it is stored.
A workaround is to add the fields to the later states and then add a a migration which manually copies the field from the first states to keep backwards compatibility. This sucks and is highly error prone.
Example: #924 is caused by this.
Alternative approach:
struct SwapDetails(everything agreed upon during swap setup like swap id, keys of the parties, tx fees, addresses, etc) andenum Statewhich then only contains the information actually existing during that state.SwapDetailsfrom every stateStateenum to hoist common fieldsThis would also fix #378 as the helper functions mostly use stuff from the
SwapDetails.