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()
|
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():
|
def snapshot():
|
||||||
conn = database.connect()
|
conn = database.connect()
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in new issue
Block a user