mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-20 18:44:20 +01:00
Fix loading b64 keysets and add option to set b64 inactive in WalletSettings (#579)
* Mint: fix loading b64 keysets and Wallet: option to set b64 inactive * typo * readd include fees flag (unused) * fix test to respect new default False flag * fix default flag for regtest
This commit is contained in:
@@ -728,6 +728,13 @@ class MintKeyset:
|
||||
assert self.seed, "seed not set"
|
||||
assert self.derivation_path, "derivation path not set"
|
||||
|
||||
# BEGIN: BACKWARDS COMPATIBILITY < 0.15.0
|
||||
# we overwrite keyset id only if it isn't already set in the database
|
||||
# loaded from the database. This is to allow for backwards compatibility
|
||||
# with old keysets with new id's and vice versa. This code and successive
|
||||
# `id_in_db or` parts can be removed if there are only new keysets in the mint (> 0.15.0)
|
||||
id_in_db = self.id
|
||||
|
||||
if self.version_tuple < (0, 12):
|
||||
# WARNING: Broken key derivation for backwards compatibility with < 0.12
|
||||
self.private_keys = derive_keys_backwards_compatible_insecure_pre_0_12(
|
||||
@@ -738,7 +745,7 @@ class MintKeyset:
|
||||
f"WARNING: Using weak key derivation for keyset {self.id} (backwards"
|
||||
" compatibility < 0.12)"
|
||||
)
|
||||
self.id = derive_keyset_id_deprecated(self.public_keys) # type: ignore
|
||||
self.id = id_in_db or derive_keyset_id_deprecated(self.public_keys) # type: ignore
|
||||
elif self.version_tuple < (0, 15):
|
||||
self.private_keys = derive_keys_sha256(self.seed, self.derivation_path)
|
||||
logger.trace(
|
||||
@@ -746,11 +753,11 @@ class MintKeyset:
|
||||
" compatibility < 0.15)"
|
||||
)
|
||||
self.public_keys = derive_pubkeys(self.private_keys) # type: ignore
|
||||
self.id = derive_keyset_id_deprecated(self.public_keys) # type: ignore
|
||||
self.id = id_in_db or derive_keyset_id_deprecated(self.public_keys) # type: ignore
|
||||
else:
|
||||
self.private_keys = derive_keys(self.seed, self.derivation_path)
|
||||
self.public_keys = derive_pubkeys(self.private_keys) # type: ignore
|
||||
self.id = derive_keyset_id(self.public_keys) # type: ignore
|
||||
self.id = id_in_db or derive_keyset_id(self.public_keys) # type: ignore
|
||||
|
||||
|
||||
# ------- TOKEN -------
|
||||
|
||||
Reference in New Issue
Block a user