New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CoinJoiClient.CreateRegisterAndConfirmCoinsAsync refactor #12947
Conversation
Moving the RegisterInputAsync function from the method. Contributes to zkSNACKs#12790 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is hard to review. It seems to me some variables got moved away to another class. By itself this is just an extra layer and adding more code plus deepening the references. Can you elaborate more on the concept what are you trying to achieve with this step?
Currently we had an oversized "lambda" (RegisterInputAsync) in a big method (CreateRegisterAndConfirmCoinsAsync) with huge amount of disposable "local variables" that is very hard to read on the first place (for example what is used in the lambda and what's not). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got it. Basically you separated RegisterInputAsync
method plus added an extra class for all the variables. It is a bit unusual to me but I saw the number of CancellationTokenSource
s that would have been needed to pass down to the method and it makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NACK
If we agree with the problem as it is stated then the cleaner, easiest and more obvious solution is not to create a new type/abstraction but simply refactor the method:
The lambda (local function) can be moved/promoted as a class method. That method can receive the values that it needs instead of using the free variables.
You make my work terribly difficult. Originally I wanted to add these whole class as an inside class, but David suggested to make it into a single file. |
Moving the RegisterInputAsync function from the method.
Contributes to #12790 (comment)