Repository navigation
Open
Labels
Description
Problem
On iOS the DashPay coreHeight backfill is not durable. A wallet that needed the backfill rescan (a contact request created below the wallet's sync cursor) rewinds and walks the same block range again on every launch. This is the #4302 behaviour: slow, never lossy.
#5026 fixed it for hosts that store the wallet's DashPayBackfillRecord and hand it back on load. Kotlin does. #5479 adds it to the SQLite backend. The Swift SDK does not store the record.
Evidence
Checked on v5.1-dev at c8a284b6c0. This is from reading the code; I have not measured the re-run on a device.
FFIPersister::stores_dashpay_backfill()is true only when the host registerson_persist_wallet_dashpay_backfill_fninPersistenceCallbacksExtension(packages/rs-platform-wallet-ffi/src/persistence.rs).makePersistenceCallbacksExtension()inPlatformWalletPersistenceHandler.swiftdoes not set that slot, and nothing underpackages/swift-sdk/Sourcesrefers to the record.- The doc comment on
PersistWalletDashPayBackfillFnstates the result: "A host without the slot keeps today's behaviour: the backfill re-fires on every launch". - The restore entry fields
has_dashpay_backfill,dashpay_backfill_floor,dashpay_backfill_rewound_fromanddashpay_backfill_coveredstay at their defaults on iOS.
What the Swift SDK needs
- Store the record. Register
on_persist_wallet_dashpay_backfill_fnand keepfloor,rewound_fromand the covered contacts in SwiftData. Every write carries the whole record, so the host replaces it and never merges. The callback fires inside the round's begin/end bracket, so the write belongs in the same transaction as the loweredsynced_height. - Hand it back on load. Fill the four
dashpay_backfill_*fields of the wallet restore entry. - Schema. The new stored fields are an additive SwiftData change, so
schema-models.jsonand the schema snapshot have to follow.
The rewind itself needs no change: the handler already assigns syncedHeight as it is handed (wallet.syncedHeight = cs.chain.synced_height), so a lowered cursor is stored as written.
Acceptance
- A wallet that ran the backfill once does not rewind again on the next launch.
- A store written before this change opens and behaves as today until the first record is written.
References
- Persist DashPay coreHeight backfill completion (rescan_triggered is in-memory only) #4302, the original issue
- fix(platform-wallet)!: persist DashPay coreHeight backfill coverage so a relaunch resumes instead of rewinding again #5026, the Rust and Kotlin fix
- feat(platform-wallet-storage): persist DashPay backfill coverage and outbound-account markers #5479, the SQLite backend
Activity