refactor save and encryption check
This commit is contained in:
parent
d50ebcf9eb
commit
583833017b
1 changed files with 4 additions and 5 deletions
|
@ -141,16 +141,15 @@ class Wallet:
|
||||||
}
|
}
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
if not self.is_locked and self.preferences.get(ENCRYPT_ON_DISK, False):
|
if self.preferences.get(ENCRYPT_ON_DISK, False):
|
||||||
if self.encryption_password:
|
if self.encryption_password:
|
||||||
self.storage.write(self.to_dict(encrypt_password=self.encryption_password))
|
return self.storage.write(self.to_dict(encrypt_password=self.encryption_password))
|
||||||
return
|
elif not self.is_locked:
|
||||||
else:
|
|
||||||
log.warning(
|
log.warning(
|
||||||
"Disk encryption requested but no password available for encryption. "
|
"Disk encryption requested but no password available for encryption. "
|
||||||
"Saving wallet in an unencrypted state."
|
"Saving wallet in an unencrypted state."
|
||||||
)
|
)
|
||||||
self.storage.write(self.to_dict())
|
return self.storage.write(self.to_dict())
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hash(self) -> bytes:
|
def hash(self) -> bytes:
|
||||||
|
|
Loading…
Reference in a new issue