diff --git a/tests/test_ledger.py b/tests/test_ledger.py index a865b70..b89b27d 100644 --- a/tests/test_ledger.py +++ b/tests/test_ledger.py @@ -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: