plugins: structure plugin storage in wallet
store all plugin data by plugin name in a root dictionary `plugin_data` inside the wallet db so that plugin data can get deleted again. Prunes the data of plugins from the wallet db on wallet stop if the plugin is not installed anymore.
This commit is contained in:
@@ -654,6 +654,10 @@ class BasePlugin(Logger):
|
||||
def read_file(self, filename: str) -> bytes:
|
||||
return self.parent.read_file(self.name, filename)
|
||||
|
||||
def get_storage(self, wallet: 'Abstract_Wallet') -> dict:
|
||||
"""Returns a dict which is persisted in the per-wallet database."""
|
||||
plugin_storage = wallet.db.get_plugin_storage()
|
||||
return plugin_storage.setdefault(self.name, {})
|
||||
|
||||
class DeviceUnpairableError(UserFacingException): pass
|
||||
class HardwarePluginLibraryUnavailable(Exception): pass
|
||||
|
||||
Reference in New Issue
Block a user