snapshot method
The on-resume cold snapshot (spec §3.3): balance, sync status, Tor
state, chain tip, balance age, and the monotonic seq. Cheap; safe to
call on resume before re-subscribing to the live stream.
Implementation
@override
Future<WalletState> snapshot() async {
snapshotCount++;
if (snapshotThrows) throw StateError('fake snapshot failure');
// ONE source of truth for the current status (#409 R1, arch review). The
// real core cannot present a split here: `SyncController::status()` and
// `subscribe()` both read the single `watch::Sender`, so a cold read and
// the live stream always agree. This fake stored the status twice and
// `push()` moved only the stream's copy, so a test could observe a
// stream/cold-read divergence the product structurally cannot produce —
// the very shape of the defect #409 R1 exists to fix (two stored copies of
// one fact, one of which nothing drives). Production reads this path:
// `walletSnapshotProvider` feeds the sync sheet's before-first-emit
// fallback.
return WalletState(
balance: _snapshot.balance,
syncStatus: _current,
tor: _snapshot.tor,
tip: _snapshot.tip,
lastSynced: _snapshot.lastSynced,
everSynced: _snapshot.everSynced,
rescanRebuilding: _snapshot.rescanRebuilding,
seq: _snapshot.seq,
);
}