aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-12-04 14:49:12 -0700
committerAdam Soltys <[email protected]>2026-12-04 14:49:12 -0700
commitdfe22eee4e698731c3e31420250bb158f2d4b2d5 (patch)
tree41509deae07ab7d6e89a5f4fdf92b825c56a23ef
parentca538f2ab033560d7fcbc488cb3b16a56cd6f06b (diff)
downloadcoinos-server-dfe22eee4e698731c3e31420250bb158f2d4b2d5.tar.gz
coinos-server-dfe22eee4e698731c3e31420250bb158f2d4b2d5.zip
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 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6WoqaQDYdpWkatPCar
-rw-r--r--lib/payments.ts27
-rw-r--r--routes/payments.ts6
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;