-
Notifications
You must be signed in to change notification settings - Fork 492
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
[refactoring] Move methods out of TransactionHistoryBuilder
#11471
[refactoring] Move methods out of TransactionHistoryBuilder
#11471
Conversation
… `SmartTransactionExtensions`. Co-authored-by: Turbolay <clement.ogame@gmail.com>
Co-authored-by: Turbolay <clement.ogame@gmail.com>
3c7c949
to
f1fd6c9
Compare
|
||
public static class SmartTransactionExtensions | ||
{ | ||
public static IEnumerable<Output> GetOutputs(this SmartTransaction smartTransaction, Network network) |
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 don't like the method name here. Imho it should be more descriptive because SmartTransaction
has already many output types.
return GetDestinationAddresses(inputs, outputs); | ||
} | ||
|
||
private static IEnumerable<BitcoinAddress> GetDestinationAddresses(ICollection<IInput> inputs, ICollection<Output> outputs) |
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 don't like the method name here. Imho it should start with the Compute
prefix and imho there should be a short documentation what it does.
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.
LGTM
@@ -36,4 +36,46 @@ public static IEnumerable<IInput> GetInputs(this SmartTransaction transaction) | |||
|
|||
return known.Concat(unknown); | |||
} | |||
|
|||
public static IEnumerable<BitcoinAddress> GetDestinationAddresses(this SmartTransaction transaction, Network network, out List<IInput> inputs, out List<Output> outputs) |
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.
Why did you prefer to explicitely pass the network instead of using Services.WalletManager.Network
?
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 would say it's personal preference because it allows easy unit-testing. Also note that this is in the WalletWasabi
project and not in the Fluent project.
It can change later if deemed necessary/useful.
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.
LGTM
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.
LGTM, overall
|
||
txRecordList.Add(new TransactionSummary(spenderTransaction, Money.Zero - coin.Amount, GetInputs(spenderTransaction), outputs, destinationAddresses)); | ||
var destinationAddresses = spenderTransaction.GetDestinationAddresses(wallet.Network, out _, out List<Output> outputs); | ||
txRecordList.Add(new TransactionSummary(spenderTransaction, Money.Zero - coin.Amount, spenderTransaction.GetInputs(), outputs, destinationAddresses)); |
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.
Input is there above but discarded. You could use them. Are those the same?
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.
Good catch, fixed.
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.
LGTM
This PR is meant to simplify #11458 and ease reviews. It should be easy to review the PR commit by commit.
Credits to @turbolay.