Add a helper that finds the sale
This commit is contained in:
1 parent
e1b0b9b568
commit
e50fa28143
1 file changed
+14
@@ -130,6 +130,20 @@ def consumptions(tx_id):
|
||||
conn.close()
|
||||
|
||||
|
||||
def sale_id(market_id):
|
||||
"""The one transaction of an account that gives sats away."""
|
||||
conn = database.connect()
|
||||
try:
|
||||
row = conn.execute(
|
||||
"SELECT id FROM transactions WHERE market_id = ? AND leg_out_sats IS NOT NULL"
|
||||
" ORDER BY id LIMIT 1",
|
||||
(market_id,),
|
||||
).fetchone()
|
||||
return row["id"]
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
def snapshot():
|
||||
conn = database.connect()
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user