mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-21 02:54:20 +01:00
@@ -692,6 +692,7 @@ class Ledger:
|
||||
logger.trace("setting proofs pending")
|
||||
await self._set_proofs_pending(proofs, conn)
|
||||
logger.trace(f"set proofs as pending")
|
||||
logger.trace("unlocked table proofs_pending")
|
||||
|
||||
try:
|
||||
await self._verify_proofs(proofs)
|
||||
@@ -754,6 +755,7 @@ class Ledger:
|
||||
logger.trace("unsetting proofs as pending")
|
||||
await self._unset_proofs_pending(proofs, conn)
|
||||
logger.trace(f"unset proofs as pending")
|
||||
logger.trace("unlocked table proofs_pending")
|
||||
|
||||
return status, preimage, return_promises
|
||||
|
||||
|
||||
@@ -57,10 +57,10 @@ async def m001_initial(db: Database):
|
||||
f"""
|
||||
CREATE VIEW {table_with_schema(db, 'balance_issued')} AS
|
||||
SELECT COALESCE(SUM(s), 0) AS balance FROM (
|
||||
SELECT SUM(amount) AS s
|
||||
SELECT SUM(amount)
|
||||
FROM {table_with_schema(db, 'promises')}
|
||||
WHERE amount > 0
|
||||
);
|
||||
) AS s;
|
||||
"""
|
||||
)
|
||||
|
||||
@@ -68,21 +68,21 @@ async def m001_initial(db: Database):
|
||||
f"""
|
||||
CREATE VIEW {table_with_schema(db, 'balance_redeemed')} AS
|
||||
SELECT COALESCE(SUM(s), 0) AS balance FROM (
|
||||
SELECT SUM(amount) AS s
|
||||
SELECT SUM(amount)
|
||||
FROM {table_with_schema(db, 'proofs_used')}
|
||||
WHERE amount > 0
|
||||
);
|
||||
) AS s;
|
||||
"""
|
||||
)
|
||||
|
||||
await db.execute(
|
||||
f"""
|
||||
CREATE VIEW {table_with_schema(db, 'balance')} AS
|
||||
SELECT s_issued - s_used AS balance FROM (
|
||||
SELECT s_issued - s_used FROM (
|
||||
SELECT bi.balance AS s_issued, bu.balance AS s_used
|
||||
FROM {table_with_schema(db, 'balance_issued')} bi
|
||||
CROSS JOIN {table_with_schema(db, 'balance_redeemed')} bu
|
||||
);
|
||||
) AS balance;
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user