Merge pull request #61 from cashubtc/mint/keyset_autosave

Mint/keyset_autosave
This commit is contained in:
calle
2022-11-26 02:58:57 +01:00
committed by GitHub
5 changed files with 8 additions and 8 deletions

View File

@@ -105,7 +105,7 @@ cashu info
Returns:
```bash
Version: 0.5.3
Version: 0.5.4
Debug: False
Cashu dir: /home/user/.cashu
Wallet: wallet

View File

@@ -53,4 +53,4 @@ LNBITS_ENDPOINT = env.str("LNBITS_ENDPOINT", default=None)
LNBITS_KEY = env.str("LNBITS_KEY", default=None)
MAX_ORDER = 64
VERSION = "0.5.3"
VERSION = "0.5.4"

View File

@@ -51,7 +51,7 @@ class Ledger:
proofs_used = await self.crud.get_proofs_used(db=self.db)
self.proofs_used = set(proofs_used)
async def load_keyset(self, derivation_path):
async def load_keyset(self, derivation_path, autosave=True):
"""Load current keyset keyset or generate new one."""
keyset = MintKeyset(
seed=self.master_key, derivation_path=derivation_path, version=VERSION
@@ -61,7 +61,7 @@ class Ledger:
tmp_keyset_local: List[MintKeyset] = await self.crud.get_keyset(
id=keyset.id, db=self.db
)
if not len(tmp_keyset_local):
if not len(tmp_keyset_local) and autosave:
logger.debug(f"Storing keyset {keyset.id}.")
await self.crud.store_keyset(keyset=keyset, db=self.db)
@@ -69,7 +69,7 @@ class Ledger:
self.keysets.keysets[keyset.id] = keyset
return keyset
async def init_keysets(self):
async def init_keysets(self, autosave=True):
"""Loads all keysets from db."""
# load all past keysets from db
tmp_keysets: List[MintKeyset] = await self.crud.get_keyset(db=self.db)
@@ -80,7 +80,7 @@ class Ledger:
logger.debug(f"Generating keys for keyset {v.id}")
v.generate_keys(self.master_key)
# load the current keyset
self.keyset = await self.load_keyset(self.derivation_path)
self.keyset = await self.load_keyset(self.derivation_path, autosave)
async def _generate_promises(
self, B_s: List[BlindedMessage], keyset: MintKeyset = None

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "cashu"
version = "0.5.3"
version = "0.5.4"
description = "Ecash wallet and mint."
authors = ["calle <callebtc@protonmail.com>"]
license = "MIT"

View File

@@ -13,7 +13,7 @@ entry_points = {"console_scripts": ["cashu = cashu.wallet.cli:cli"]}
setuptools.setup(
name="cashu",
version="0.5.3",
version="0.5.4",
description="Ecash wallet and mint with Bitcoin Lightning support",
long_description=long_description,
long_description_content_type="text/markdown",