Let what a transfer sends be exactly what arrives
This commit is contained in:
1 parent
a6adeedd1a
commit
8436cffb23
1 file changed
+7
-7
@@ -217,7 +217,7 @@ def _sync_transfer_pair(conn, tx_id, previous, tx):
|
|||||||
conn.execute(
|
conn.execute(
|
||||||
"UPDATE transactions SET transfer_group = ? WHERE id = ?", (group, tx_id)
|
"UPDATE transactions SET transfer_group = ? WHERE id = ?", (group, tx_id)
|
||||||
)
|
)
|
||||||
arrived = (tx["leg_out_sats"] or 0) - (tx["fee_sats"] or 0)
|
arrived = tx["leg_out_sats"] or 0
|
||||||
now = _now_stamp()
|
now = _now_stamp()
|
||||||
row = conn.execute(
|
row = conn.execute(
|
||||||
"SELECT id FROM transactions WHERE type = 'transfer_in' AND transfer_group = ?",
|
"SELECT id FROM transactions WHERE type = 'transfer_in' AND transfer_group = ?",
|
||||||
@@ -227,17 +227,17 @@ def _sync_transfer_pair(conn, tx_id, previous, tx):
|
|||||||
conn.execute(
|
conn.execute(
|
||||||
"INSERT INTO transactions (date, type, market_id, taxable, note, leg_in_sats,"
|
"INSERT INTO transactions (date, type, market_id, taxable, note, leg_in_sats,"
|
||||||
" fee_sats, fee_ore, to_market_id, transfer_group, generated, created_at,"
|
" fee_sats, fee_ore, to_market_id, transfer_group, generated, created_at,"
|
||||||
" updated_at) VALUES (?, 'transfer_in', ?, ?, '', ?, ?, ?, ?, ?, 1, ?, ?)",
|
" updated_at) VALUES (?, 'transfer_in', ?, ?, '', ?, 0, 0, ?, ?, 1, ?, ?)",
|
||||||
(tx["date"], tx["to_market_id"], tx["taxable"], arrived, tx["fee_sats"],
|
(tx["date"], tx["to_market_id"], tx["taxable"], arrived,
|
||||||
tx["fee_ore"], tx["market_id"], group, now, now),
|
tx["market_id"], group, now, now),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"UPDATE transactions SET date = ?, market_id = ?, taxable = ?,"
|
"UPDATE transactions SET date = ?, market_id = ?, taxable = ?,"
|
||||||
" leg_in_sats = ?, fee_sats = ?, fee_ore = ?, to_market_id = ?,"
|
" leg_in_sats = ?, fee_sats = 0, fee_ore = 0, to_market_id = ?,"
|
||||||
" generated = 1, updated_at = ? WHERE id = ?",
|
" generated = 1, updated_at = ? WHERE id = ?",
|
||||||
(tx["date"], tx["to_market_id"], tx["taxable"], arrived, tx["fee_sats"],
|
(tx["date"], tx["to_market_id"], tx["taxable"], arrived,
|
||||||
tx["fee_ore"], tx["market_id"], now, row["id"]),
|
tx["market_id"], now, row["id"]),
|
||||||
)
|
)
|
||||||
elif group:
|
elif group:
|
||||||
_drop_ledger(conn)
|
_drop_ledger(conn)
|
||||||
|
|||||||
Reference in new issue
Block a user