mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 17:55:20 +00:00
wizard.create_storage: state API and abide by it
none of the callers was handling the return None case properly...
This commit is contained in:
parent
a3e1b2e00c
commit
08a7925235
2 changed files with 6 additions and 7 deletions
|
@ -28,7 +28,7 @@ import sys
|
|||
import copy
|
||||
import traceback
|
||||
from functools import partial
|
||||
from typing import List, TYPE_CHECKING, Tuple, NamedTuple, Any, Dict, Optional
|
||||
from typing import List, TYPE_CHECKING, Tuple, NamedTuple, Any, Dict, Optional, Union
|
||||
|
||||
from . import bitcoin
|
||||
from . import keystore
|
||||
|
@ -611,12 +611,10 @@ class BaseWizard(Logger):
|
|||
encrypt_keystore=encrypt_keystore)
|
||||
self.terminate()
|
||||
|
||||
|
||||
def create_storage(self, path):
|
||||
def create_storage(self, path) -> Tuple[WalletStorage, WalletDB]:
|
||||
if os.path.exists(path):
|
||||
raise Exception('file already exists at path')
|
||||
if not self.pw_args:
|
||||
return # FIXME
|
||||
assert self.pw_args, f"pw_args not set?!"
|
||||
pw_args = self.pw_args
|
||||
self.pw_args = None # clean-up so that it can get GC-ed
|
||||
storage = WalletStorage(path)
|
||||
|
@ -630,7 +628,9 @@ class BaseWizard(Logger):
|
|||
db.write(storage)
|
||||
return storage, db
|
||||
|
||||
def terminate(self, *, storage: Optional[WalletStorage], db: Optional[WalletDB] = None):
|
||||
def terminate(self, *, storage: WalletStorage = None,
|
||||
db: WalletDB = None,
|
||||
aborted: bool = False) -> None:
|
||||
raise NotImplementedError() # implemented by subclasses
|
||||
|
||||
def show_xpub_and_add_cosigners(self, xpub):
|
||||
|
|
|
@ -189,7 +189,6 @@ class WalletStorage(Logger):
|
|||
s = ''
|
||||
self.pubkey = ec_key.get_public_key_hex()
|
||||
self.decrypted = s
|
||||
return s
|
||||
|
||||
def encrypt_before_writing(self, plaintext: str) -> str:
|
||||
s = plaintext
|
||||
|
|
Loading…
Add table
Reference in a new issue