mint saves keyset ids

This commit is contained in:
callebtc
2022-10-08 15:08:20 +02:00
parent 5c7c7f9965
commit fad9b91061
6 changed files with 39 additions and 23 deletions

View File

@@ -16,6 +16,7 @@ from cashu.core.secp import PublicKey
from cashu.core.settings import LIGHTNING, MAX_ORDER
from cashu.core.split import amount_split
from cashu.lightning import WALLET
from cashu.core.crud import get_keyset, store_keyset
from cashu.mint.crud import (
get_lightning_invoice,
get_proofs_used,
@@ -36,6 +37,11 @@ class Ledger:
async def load_used_proofs(self):
self.proofs_used = set(await get_proofs_used(db=self.db))
async def store_keyset(self):
keyset_local: Keyset = await get_keyset(self.keyset.id, db=self.db)
if keyset_local is None:
await store_keyset(keyset=self.keyset, db=self.db)
async def _generate_promises(self, amounts: List[int], B_s: List[str]):
"""Generates promises that sum to the given amount."""
return [