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")
|
logger.trace("setting proofs pending")
|
||||||
await self._set_proofs_pending(proofs, conn)
|
await self._set_proofs_pending(proofs, conn)
|
||||||
logger.trace(f"set proofs as pending")
|
logger.trace(f"set proofs as pending")
|
||||||
|
logger.trace("unlocked table proofs_pending")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await self._verify_proofs(proofs)
|
await self._verify_proofs(proofs)
|
||||||
@@ -754,6 +755,7 @@ class Ledger:
|
|||||||
logger.trace("unsetting proofs as pending")
|
logger.trace("unsetting proofs as pending")
|
||||||
await self._unset_proofs_pending(proofs, conn)
|
await self._unset_proofs_pending(proofs, conn)
|
||||||
logger.trace(f"unset proofs as pending")
|
logger.trace(f"unset proofs as pending")
|
||||||
|
logger.trace("unlocked table proofs_pending")
|
||||||
|
|
||||||
return status, preimage, return_promises
|
return status, preimage, return_promises
|
||||||
|
|
||||||
|
|||||||
@@ -57,10 +57,10 @@ async def m001_initial(db: Database):
|
|||||||
f"""
|
f"""
|
||||||
CREATE VIEW {table_with_schema(db, 'balance_issued')} AS
|
CREATE VIEW {table_with_schema(db, 'balance_issued')} AS
|
||||||
SELECT COALESCE(SUM(s), 0) AS balance FROM (
|
SELECT COALESCE(SUM(s), 0) AS balance FROM (
|
||||||
SELECT SUM(amount) AS s
|
SELECT SUM(amount)
|
||||||
FROM {table_with_schema(db, 'promises')}
|
FROM {table_with_schema(db, 'promises')}
|
||||||
WHERE amount > 0
|
WHERE amount > 0
|
||||||
);
|
) AS s;
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -68,21 +68,21 @@ async def m001_initial(db: Database):
|
|||||||
f"""
|
f"""
|
||||||
CREATE VIEW {table_with_schema(db, 'balance_redeemed')} AS
|
CREATE VIEW {table_with_schema(db, 'balance_redeemed')} AS
|
||||||
SELECT COALESCE(SUM(s), 0) AS balance FROM (
|
SELECT COALESCE(SUM(s), 0) AS balance FROM (
|
||||||
SELECT SUM(amount) AS s
|
SELECT SUM(amount)
|
||||||
FROM {table_with_schema(db, 'proofs_used')}
|
FROM {table_with_schema(db, 'proofs_used')}
|
||||||
WHERE amount > 0
|
WHERE amount > 0
|
||||||
);
|
) AS s;
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
await db.execute(
|
await db.execute(
|
||||||
f"""
|
f"""
|
||||||
CREATE VIEW {table_with_schema(db, 'balance')} AS
|
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
|
SELECT bi.balance AS s_issued, bu.balance AS s_used
|
||||||
FROM {table_with_schema(db, 'balance_issued')} bi
|
FROM {table_with_schema(db, 'balance_issued')} bi
|
||||||
CROSS JOIN {table_with_schema(db, 'balance_redeemed')} bu
|
CROSS JOIN {table_with_schema(db, 'balance_redeemed')} bu
|
||||||
);
|
) AS balance;
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user