Repository navigation
Description
TL;DR: The background DashPay sync gives apps no signal when it finishes, so apps poll a timestamp to learn that contacts, requests or profiles changed.
User story
As a wallet app developer, I want to be told when a DashPay sync pass finishes, as I already am for platform-address, DPNS-marketplace and shielded syncs, so that my contact and request screens refresh right away without polling.
As a DashPay user, I want a new contact request or a contact's new profile to appear as soon as the wallet has it.
Scenario
Base flow
- The app starts the DashPay sync coordinator, which runs every 15 seconds.
- A contact sends a request, and the next pass stores it in the identity's DashPay state.
Actual behavior
Nothing tells the app. To notice the pass it has to poll the coordinator's last-sync timestamp from its UI loop and rebuild its view whenever the value moves.
Expected behavior
After every pass, the app's event handler hears on_dashpay_sync_completed with the pass summary, as it already does for the sibling coordinators.
Detailed discussion
On v5.1-dev @ 575d961fe0:
PlatformEventHandlerhason_platform_address_sync_completed,on_dpns_marketplace_sync_completedandon_shielded_sync_completed, but no DashPay hook (events.rs#L28-L104; fan-out inPlatformEventManagerat #L114-L170).DpnsSyncManagerholdsevents: Arc<PlatformEventManager>(manager/dpns_sync.rs#L133-L134) and fires its event after each pass (#L318).DashPaySyncManager::newtakes no event manager (manager/dashpay_sync.rs#L154-L167; built at manager/mod.rs#L615).sync_nowbuilds aDashPaySyncSummaryand only stores the timestamp inlast_sync_unix(#L345-L404; getterlast_sync_unix_secondsat #L194).
Downstream: Dash Evo Tool polls last_sync_unix_seconds() from its frame loop to decide when to rebuild its DashPay view (src/backend_task/dashpay/sync.rs, marked TODO(upstream): on_dashpay_sync_completed).
Proposed change
// events.rs
pub trait PlatformEventHandler: EventHandler {
/// After every DashPay pass that ran (not after a skipped, re-entrant call).
fn on_dashpay_sync_completed(&self, _summary: &DashPaySyncSummary) {}
}
impl PlatformEventManager {
pub fn on_dashpay_sync_completed(&self, summary: &DashPaySyncSummary) {
// fan out, as on_dpns_marketplace_sync_completed does
}
}
// manager/dashpay_sync.rs: hold `events: Arc<PlatformEventManager>` as DpnsSyncManager does,
// and at the end of `sync_now`, when `summary.sync_unix_seconds != 0`:
// self.events.on_dashpay_sync_completed(&summary);A default no-op method keeps existing handlers compiling. It would also help if the summary listed the identity ids whose DashPay state changed in the pass, so an app can rebuild only those. That is optional; the event alone removes the polling.
Prior work
- feat(platform-wallet): wallet-level DPNS username marketplace with FFI and Swift wrappers #4348: added the DPNS-marketplace coordinator and its
on_dpns_marketplace_sync_completedevent, the pattern to mirror. - feat: complete dashpay in platform wallet and swift example app #3841: introduced
DashPaySyncManager, without an event.
Attribution
🤖 Co-authored by Claudius the Magnificent AI Agent
Activity