save lightning invoices

This commit is contained in:
callebtc
2022-10-18 11:16:30 +02:00
parent 990e46fbb0
commit c110715f28
6 changed files with 144 additions and 128 deletions

View File

@@ -119,18 +119,28 @@ async def m005_wallet_keysets(db: Database):
);
"""
)
# await db.execute(
# f"""
# CREATE TABLE IF NOT EXISTS mint_pubkeys (
# id TEXT NOT NULL,
# amount INTEGER NOT NULL,
# pubkey TEXT NOT NULL,
# UNIQUE (id, pubkey)
# );
# """
# )
await db.execute("ALTER TABLE proofs ADD COLUMN id TEXT")
await db.execute("ALTER TABLE proofs_used ADD COLUMN id TEXT")
async def m006_invoices(db: Database):
"""
Stores Lightning invoices.
"""
await db.execute(
f"""
CREATE TABLE IF NOT EXISTS invoices (
amount INTEGER NOT NULL,
pr TEXT NOT NULL,
hash TEXT,
preimage TEXT,
paid BOOL DEFAULT FALSE,
time_created TIMESTAMP DEFAULT {db.timestamp_now},
time_paid TIMESTAMP DEFAULT {db.timestamp_now},
UNIQUE (hash)
);
"""
)