mirror of
https://github.com/Such-Software/xmrcheckout.git
synced 2026-10-21 06:28:37 +02:00
fix: don't delete transfer records on empty wallet-rpc response
If wallet-rpc returns an empty response (transient network issue, daemon temporarily unavailable), seen_txids is empty and ALL stored InvoiceTransfer records for that invoice are deleted. When wallet-rpc recovers, transfers are re-created with new DB IDs. This guard only prunes transfers when we actually got data back.
This commit is contained in:
@@ -271,10 +271,13 @@ def _sync_invoice_transfers(
|
||||
stored.timestamp = transfer.timestamp
|
||||
stored.address = transfer.address
|
||||
changed = True
|
||||
for stored in existing:
|
||||
if stored.txid not in seen_txids:
|
||||
db.delete(stored)
|
||||
changed = True
|
||||
# Only prune transfers if we actually got data back from wallet-rpc.
|
||||
# An empty response (transient RPC glitch) should not wipe confirmed records.
|
||||
if transfers:
|
||||
for stored in existing:
|
||||
if stored.txid not in seen_txids:
|
||||
db.delete(stored)
|
||||
changed = True
|
||||
return changed
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user