diff options
| -rw-r--r-- | lib/payments.ts | 27 | ||||
| -rw-r--r-- | routes/payments.ts | 6 |
2 files changed, 21 insertions, 12 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 }); diff --git a/routes/payments.ts b/routes/payments.ts index 011aabb4..ca68bcdf 100644 --- a/routes/payments.ts +++ b/routes/payments.ts @@ -594,7 +594,11 @@ export default { try { const node = rpc({ ...config[type], wallet }); const { confirmations, details } = await node.getTransaction(txid); - const hot = wallet === config[type].wallet; + // A retired hot wallet still receives deposits to the addresses it handed + // out (2026-12-04: the "coinos" wallet's keys were stolen; "coinos2" took + // over and the old one is loaded as config.bitcoin.legacyWallets). Its + // deposits are credited like the hot wallet's, by invoice address. + const hot = wallet === config[type].wallet || (config[type].legacyWallets || []).includes(wallet); let aid; if (!hot) aid = wallet; |
