Fix Monero mempool detection in crypto watcher
- Add fallback to check all account transfers when subaddress filter returns no results - This helps detect mempool transactions that may not immediately appear in subaddress-filtered queries - Include both 'in' and 'pool' transfers from get_transfers RPC call - Filter results to match the specific subaddress we're monitoring - Addresses issue where mempool transactions are visible in wallet but not detected by watcher
This commit is contained in:
parent
fa8ca79988
commit
d3f2c1caa4
1 changed files with 36 additions and 0 deletions
|
|
@ -1223,6 +1223,42 @@ def run_once(env, interval):
|
|||
or {}
|
||||
)
|
||||
incoming = res.get("in", []) or []
|
||||
|
||||
# Fallback: If no transfers found for subaddress, check all account transfers
|
||||
# This helps with mempool transactions that might not immediately show up
|
||||
# in subaddress-filtered queries
|
||||
if not incoming:
|
||||
logger.debug(f"No transfers found for subaddress {crypto_payment.subaddress_index}, checking all account transfers")
|
||||
try:
|
||||
# Check all transfers for this account (including mempool)
|
||||
all_transfers_result = client._call("get_transfers", {
|
||||
"in": True,
|
||||
"out": False,
|
||||
"pending": True,
|
||||
"failed": False,
|
||||
"pool": True, # Include mempool transactions
|
||||
"account_index": crypto_payment.account_index,
|
||||
# Don't filter by subaddr_indices - get all transfers
|
||||
})
|
||||
|
||||
all_incoming = all_transfers_result.get("in", []) if all_transfers_result else []
|
||||
# Also check pool (mempool) transactions
|
||||
pool_incoming = all_transfers_result.get("pool", []) if all_transfers_result else []
|
||||
all_incoming.extend(pool_incoming)
|
||||
|
||||
# Filter for our specific subaddress
|
||||
for tx in all_incoming:
|
||||
if (tx.get("subaddr_index", {}).get("minor") == crypto_payment.subaddress_index and
|
||||
tx.get("subaddr_index", {}).get("major") == crypto_payment.account_index):
|
||||
incoming.append(tx)
|
||||
logger.debug(f"Found transfer for our subaddress in all-account query: {tx.get('txid', 'unknown')[:8]}...")
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to query all account transfers for mempool fallback: {e}")
|
||||
|
||||
if incoming:
|
||||
logger.debug(f"Found {len(incoming)} transfers for payment {crypto_payment.id}")
|
||||
else:
|
||||
logger.debug(f"No transfers found for payment {crypto_payment.id} (subaddress {crypto_payment.subaddress_index})")
|
||||
elif coin_type == "DOGE":
|
||||
# Dogecoin: Query received by address
|
||||
incoming = get_dogecoin_incoming_transfers(client, crypto_payment)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue