hide the rescan control on a source that cannot rescan
the card keyed off `sync.rescan` being null, which is what esplora reports — and equally what nbxplorer reports before its first scan. so the guard could not tell "unsupported" from "not yet run" and resolved it the wrong way: every esplora wallet got a button that 501s. canRescan carries the distinction explicitly. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -313,6 +313,7 @@ export class OnchainBackend extends BaseBackend {
|
||||
syncedAt: this.current?.at ?? null,
|
||||
stale: this.current !== null && Date.now() - this.current.at >= SCAN_TTL_MS,
|
||||
lastError: this.lastError,
|
||||
canRescan: this.chain.startRescan !== undefined,
|
||||
rescan: this.chain.rescanState?.() ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -321,6 +321,14 @@ export type SyncState = {
|
||||
stale: boolean;
|
||||
/** The last refresh failure, still reported while the previous good data is being served. */
|
||||
lastError: string | null;
|
||||
/**
|
||||
* Whether this chain source can search the chain from scratch at all. False for Esplora, which asks
|
||||
* about every address on every refresh and so has nothing to catch up on.
|
||||
*
|
||||
* Distinct from `rescan === null`, which is ALSO what a source that simply hasn't run one yet reports
|
||||
* — conflating the two put a button that 501s in front of every Esplora wallet.
|
||||
*/
|
||||
canRescan: boolean;
|
||||
/** A deep rescan in flight, or the outcome of the last one. Null from a source that cannot rescan. */
|
||||
rescan: RescanState | null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user