-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
add wallet rename functionality, and add to qml client #8934
base: master
Are you sure you want to change the base?
Conversation
c7520cb
to
439f83f
Compare
439f83f
to
297d59a
Compare
@with_wallet_lock | ||
def rename_wallet(self, wallet: 'Abstract_Wallet', new_basename): | ||
if not wallet.db.storage: | ||
return | ||
|
||
path = wallet.db.storage.path | ||
wallet_key = self._wallet_key_from_path(path) | ||
wallet = self._wallets.get(wallet_key) | ||
assert wallet | ||
|
||
new_path = wallet.rename_wallet(new_basename) | ||
new_wallet_key = self._wallet_key_from_path(new_path) | ||
self._wallets.pop(wallet_key) | ||
self._wallets[new_wallet_key] = wallet |
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.
As a completely different approach, have you considered unloading the wallet, changing the name of file on disk, and then loading the wallet again? so e.g. daemon._stop_wallet()
, os.rename()
, daemon.load_wallet()
Disregarding GUI concerns, from a trying-to-avoid-subtle-bugs and keeping things simple point of view, that seems to me like a potentially more interesting approach :P but maybe that has its own complications (?)
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 this has complications. There are many references held to Wallet
instances, but very few to WalletStorage
instances, making the above approach a bit better manageable.
Unloading+loading on Desktop probably requires to destroy the toplevel window associated with the wallet, which might be problematic when it's the only/last window (app closing?), and visually disturbing.
On Android/QML it would also be quite tricky to get right.
Unloading+loading is quite a complex code path..
297d59a
to
254ac39
Compare
No description provided.