This commit is contained in:
callebtc
2022-10-03 21:35:48 +02:00
parent 78e94ecf66
commit 0ba72ee3f9
3 changed files with 18 additions and 10 deletions

View File

@@ -93,7 +93,7 @@ async def get_lightning_invoice(
SELECT * from invoices
WHERE hash = ?
""",
hash,
(hash,),
)
return Invoice.from_row(row)
@@ -106,5 +106,8 @@ async def update_lightning_invoice(
):
await (conn or db).execute(
"UPDATE invoices SET issued = ? WHERE hash = ?",
(issued, hash),
(
issued,
hash,
),
)

View File

@@ -30,9 +30,9 @@ class Ledger:
def __init__(self, secret_key: str, db: str):
self.proofs_used: Set[str] = set()
self.master_key: str = secret_key
self.keys: List[PrivateKey] = self._derive_keys(self.master_key)
self.pub_keys: List[PublicKey] = self._derive_pubkeys(self.keys)
self.master_key = secret_key
self.keys = self._derive_keys(self.master_key)
self.pub_keys = self._derive_pubkeys(self.keys)
self.db: Database = Database("mint", db)
async def load_used_proofs(self):

View File

@@ -1,5 +1,5 @@
import time
from typing import Optional, List
from typing import Optional, List, Any
from cashu.core.base import Proof, P2SHScript
from cashu.core.db import Connection, Database
@@ -59,7 +59,7 @@ async def invalidate_proof(
DELETE FROM proofs
WHERE secret = ?
""",
str(proof["secret"]),
(str(proof["secret"]),),
)
await (conn or db).execute(
@@ -80,7 +80,7 @@ async def update_proof_reserved(
conn: Optional[Connection] = None,
):
clauses = []
values = []
values: List[Any] = []
clauses.append("reserved = ?")
values.append(reserved)
@@ -110,7 +110,7 @@ async def secret_used(
SELECT * from proofs
WHERE secret = ?
""",
(secret),
(secret,),
)
return rows is not None
@@ -127,7 +127,12 @@ async def store_p2sh(
(address, script, signature, used)
VALUES (?, ?, ?, ?)
""",
(p2sh.address, p2sh.script, p2sh.signature, False),
(
p2sh.address,
p2sh.script,
p2sh.signature,
False,
),
)