Skip to content

[Refactor] withdraw_archive.go (and deduplicate SwapHandler-received validateV93) #unsafe

Multipartite requested to merge Multipartite/thornode:2579-cleanups into develop

[Version-unspecific]

The withdraw files are classless, like handler_ files rather than manager_ files,
but currently have all their name-versioned functions duplicated to make a new version of any one function.

Refactoring with a withdraw_archive.go file, with all nine currently-used functions in withdraw.go ,
there are only five older-version functions in withdraw_archive.go :
withdrawV91 / withdrawV89 / withdrawV84 / withdrawV76 / calcImpLossV76

In a hard fork, older-version files are deleted or cleared
(and any currently-used functions previously moved to an _archive file would have to be moved back anyway to the file for currently-used functions);
it can and has been checked that doing this for this refactor (and removing all withdraw.go switch cases except for the current version)
only produces a singleCaseSwitch issue (as is expected for leaving only one switch case).
|
https://gitlab.com/Multipartite/thornode/-/commits/withdraw-pruning-check
Multipartite/thornode@0ff15897 (pruning check commit)
https://gitlab.com/Multipartite/thornode/-/pipelines/681562146
https://gitlab.com/Multipartite/thornode/-/jobs/3252079932 (unit-tests job)
https://gitlab.com/Multipartite/thornode/-/jobs/3252079933 (lint job)

Feedback is welcome.

Edit: Responding to !2643 (merged)'s dupliated-functions output, I have now added a commit to remove SwapHandler-received validateV93 as well (after having checked for other .validateV93 instances).

Edited by Multipartite

Merge request reports