From 1c14b0818be88ca1e061cf9882f35575809e9a12 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 22 Sep 2026 11:26:45 -0700 Subject: Ark: the receive rescan starts at index zero — another device of the same wallet may have minted lower. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01Tmfg8k5f3TbNJS34qiqHAp --- src/ark/manager.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ark/manager.js b/src/ark/manager.js index 90c98a0..928edf8 100644 --- a/src/ark/manager.js +++ b/src/ark/manager.js @@ -1408,10 +1408,12 @@ export class ArkManager { // calls, once per connect. async rescanLnReceives(depth = 6) { const have = new Set((this.state.actions || []).filter((a) => a.type === 'ln-recv').map((a) => a.paymentHash)); - const start = Math.max(0, (this.state.nextLnRecvIndex || 0) - 2); + // from index zero: another device of this wallet (same seed, same + // derivation) may have minted at a LOWER index than this one's counter + const end = (this.state.nextLnRecvIndex || 0) + depth; const minCltvDelta = (this.info.vtxoExitDelta || 0) + (this.info.htlcExpiryDelta || 6) + 12 + 18 + 2; let found = 0; - for (let idx = start; idx < start + depth + 2; idx++) { + for (let idx = 0; idx < end; idx++) { const paymentHash = sha256(this._lnPreimage(idx)); const hashHex = hex.encode(paymentHash); if (have.has(hashHex)) continue; -- cgit v1.2.3