diff options
| author | Adam Soltys <[email protected]> | 2026-06-14 23:31:56 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-06-14 23:31:56 -0700 |
| commit | f477756f5f04e65c68d2e51100c660c13505d1f2 (patch) | |
| tree | 3c89ff413e2a9f2d5ef5928ef22b398dd5866cbe | |
| parent | dcd71b82beab1fe98506bd5ed31bc10cf039f233 (diff) | |
| download | coinosv3-f477756f5f04e65c68d2e51100c660c13505d1f2.tar.gz coinosv3-f477756f5f04e65c68d2e51100c660c13505d1f2.zip | |
Reduce gap limit to 5; clarify receive-address note
Since the wallet only ever exposes one unused receive address at a time,
used addresses stay contiguous (gap never exceeds 1), so a gap limit of 5 is
a safe margin and cuts a scan from ~40 to ~10 requests.
Also reword the receive note: the address advances automatically (via the
realtime WebSocket) when paid, so drop the confusing "scan again".
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
| -rw-r--r-- | src/app.js | 2 | ||||
| -rw-r--r-- | src/wallet.js | 8 |
2 files changed, 8 insertions, 2 deletions
@@ -506,7 +506,7 @@ function receiveTab() { ), h('div', { class: 'path' }, `m/84'/${coin}'/0'/0/${fresh.index}`), h('p', { class: 'small muted center', style: 'margin:0' }, - 'A fresh address is shown for better privacy. After a payment arrives, scan again to advance to a new one.'), + 'A fresh address is shown for better privacy. When it receives a payment, a new one appears automatically.'), addressBook() ); } diff --git a/src/wallet.js b/src/wallet.js index 04f303a..21fbcf2 100644 --- a/src/wallet.js +++ b/src/wallet.js @@ -17,7 +17,13 @@ import { p2wpkh } from '@scure/btc-signer/payment'; import { Api, pool } from './api.js'; -const GAP_LIMIT = 20; // BIP44 standard gap limit +// The BIP44 standard gap limit is 20, but that means ~40 address lookups per +// scan. We can safely use a much smaller limit because this wallet only ever +// exposes ONE unused receive address at a time (freshReceive = first unused; +// there is no "generate another address" button). That keeps used addresses +// contiguous, so the gap between them is never more than 1 — a limit of 5 is a +// comfortable safety margin while cutting scan requests ~4x. +const GAP_LIMIT = 5; const NETS = { mainnet: { net: btc.NETWORK, coin: 0 }, |
