From dfe22eee4e698731c3e31420250bb158f2d4b2d5 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 4 Dec 2026 14:49:12 -0700 Subject: Credit deposits to a retired hot wallet's addresses (legacyWallets). 2026-12-04: the bitcoin hot wallet's keys were stolen, so coinos moved to a new hot wallet. Users still pay the deposit addresses the old one handed out. With the old wallet loaded and named in config.bitcoin.legacyWallets, /confirm treats it like the hot wallet (credited by invoice address, not as an account wallet) and catchUp lists its receives too, posting its own wallet name. The coins themselves are swept to the new wallet by a host-side job. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VMan6WoqaQDYdpWkatPCar --- lib/payments.ts | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'lib/payments.ts') 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 }); -- cgit v1.2.3