-
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
Wallets load - remove refresh mechanism #12299
Conversation
Tested all the "add" scenarios - worked.
|
Doesn't build |
diff --git a/WalletWasabi.Fluent/Helpers/WalletHelpers.cs b/WalletWasabi.Fluent/Helpers/WalletHelpers.cs
index 8ba1a23b48..c5dde28025 100644
--- a/WalletWasabi.Fluent/Helpers/WalletHelpers.cs
+++ b/WalletWasabi.Fluent/Helpers/WalletHelpers.cs
@@ -27,7 +27,7 @@ public static class WalletHelpers
{
var result = new List<LabelsByWallet>();
- foreach (var wallet in Services.WalletManager.GetWallets(refreshWalletList: false))
+ foreach (var wallet in Services.WalletManager.GetWallets())
{
var (changeLabels, receiveLabels) = wallet.KeyManager.GetLabels();
result.Add(new LabelsByWallet(wallet.WalletId, changeLabels, receiveLabels)); |
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.
tACK
I tried to see if it creates some problems but in fact, when touching wallet files, there are less issues on this branch rather than on master
I'd change the name of the function RefreshWalletList
-> LoadWalletListFromFileSystem
Unrelated: It might be useful to verify integrity of the files when renaming (and disable the feature instead of creating a duplicate of the wallet file) and when quitting the software, even if I dont really know what to do if wallet files changed.
@@ -185,15 +185,10 @@ public void RenameWallet(Wallet wallet, string newWalletName) | |||
return null; | |||
} | |||
|
|||
public Task<IEnumerable<IWallet>> GetWalletsAsync() => Task.FromResult<IEnumerable<IWallet>>(GetWallets(refreshWalletList: true)); |
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.
Refreshing wallets was true
by default, now this behavior changed.
Out of 7 references 6 looks safe to me, but there is one instance, the RPC.
The RPC method listwallets
was "refreshing"/ loading wallets from disk. With this PR it doesn't.
Perhaps we should update the RPC method to call WalletManager.RefreshWalletList
manually.
WDYT?
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 think it's as safe as the other calls. I tested and had no issue
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.
When someone creates a wallet he/she should use the RPC as well and in that case it will be added.
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.
tACK, couldn't break the software
Whenever wallets are enumerated in the WalletManager we also check if someone added a wallet file to the wallet folder. Wallets are enumerated tons of times, so the folder check is called many times. Enumerate files in a folder takes time it is an I/O operation - thus this is not performant, nor required.
Questions: