diff options
Diffstat (limited to 'lib/payments.ts')
| -rw-r--r-- | lib/payments.ts | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/payments.ts b/lib/payments.ts index 59c6d397..6cde225c 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -1515,19 +1515,24 @@ export const catchUp = async () => { // Each chain is isolated: one being unreachable (e.g. lq when cs is down) // must not stop the other chain's deposit-recovery loop. for (const [type, n] of Object.entries({ bitcoin: bc, liquid: lq })) { - try { - txns.push( - ...(await n.listTransactions("*", 100)).filter((tx) => { - tx.type = type; - return tx.category === "receive" && tx.confirmations > 0; - }), - ); - } catch (e: any) { - warnThrottled(`catchUp ${type}`, e.message); + // the hot wallet, then any retired ones still receiving (legacyWallets) + const wallets = [[config[type]?.wallet, n], ...((config[type]?.legacyWallets || []).map((w) => [w, rpc({ ...config[type], wallet: w })]))]; + for (const [wallet, node] of wallets) { + try { + txns.push( + ...(await node.listTransactions("*", 100)).filter((tx) => { + tx.type = type; + tx.wallet = wallet; + return tx.category === "receive" && tx.confirmations > 0; + }), + ); + } catch (e: any) { + warnThrottled(`catchUp ${type} ${wallet}`, e.message); + } } } - for (const { txid, type } of txns) { + for (const { txid, type, wallet } of txns) { try { if (await db.zScore("seen", txid)) continue; // walletnotify is the primary path; catchUp is a safety net. The @@ -1535,7 +1540,7 @@ export const catchUp = async () => { // on cs's lq — now that's fixed, a single call suffices and avoids // contributing to /confirm race conditions. await got.post(`http://localhost:${process.env.PORT || 3119}/confirm`, { - json: { txid, wallet: config[type].wallet, type }, + json: { txid, wallet: wallet || config[type].wallet, type }, }); await db.zAdd("seen", { score: Date.now(), value: txid }); |
