diff options
| author | Adam Soltys <[email protected]> | 2026-09-22 11:26:45 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-09-22 11:26:45 -0700 |
| commit | 1c14b0818be88ca1e061cf9882f35575809e9a12 (patch) | |
| tree | 9b5bd58a00978a319daed406487c41bcea7c2863 /src/ark/manager.js | |
| parent | 229746922fbd566ef9014845c2111c5044ac91fa (diff) | |
| download | coinosv3-1c14b0818be88ca1e061cf9882f35575809e9a12.tar.gz coinosv3-1c14b0818be88ca1e061cf9882f35575809e9a12.zip | |
Ark: the receive rescan starts at index zero — another device of the same wallet may have minted lower.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Tmfg8k5f3TbNJS34qiqHAp
Diffstat (limited to 'src/ark/manager.js')
| -rw-r--r-- | src/ark/manager.js | 6 |
1 files changed, 4 insertions, 2 deletions
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; |
