Skip to content

Add cancellable Payjoin polling countdown - #869

Open
Sandipmandal25 wants to merge 1 commit into
masterfrom
feat/payjoin-waiting-ui
Open

Add cancellable Payjoin polling countdown#869
Sandipmandal25 wants to merge 1 commit into
masterfrom
feat/payjoin-waiting-ui

Conversation

@Sandipmandal25

@Sandipmandal25 Sandipmandal25 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add a PayJoin waiting state with a live session countdown on iOS and Android.
  • Show when the sender is waiting for the receiver.
  • Allow users to cancel PayJoin and send the fallback transaction normally.
  • Handle successful broadcasts and errors from the new waiting state.

Why

PayJoin polling can take time, but the send screen previously showed only a generic loading state with no indication of what was happening or how long remained.

This gives users clearer feedback and lets them fall back to a normal send without waiting for the session to expire.

Checklist

Summary by CodeRabbit

  • New Features
    • Added a payjoin waiting state with a visible countdown during transaction processing.
    • Added an option to cancel an active payjoin attempt.
    • Cancellation now safely falls back and refreshes wallet activity.
  • Bug Fixes
    • Improved handling of payjoin success and errors while waiting.
    • Countdown state is cleared after broadcasts or send-flow errors.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 364c3fc3-b51a-4003-806f-1c6abf5c2e83

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Payjoin polling now reports an absolute deadline, exposes cancellation, and propagates waiting state through Rust, Android, and iOS. Both mobile send flows display countdown controls and handle cancellation, broadcast completion, and errors during polling.

Changes

Payjoin polling lifecycle

Layer / File(s) Summary
Rust polling and cancellation lifecycle
rust/src/manager/wallet_manager.rs, rust/src/manager/wallet_manager/actor.rs, rust/src/manager/wallet_manager/payjoin.rs
Rust reports the polling deadline, exposes cancel_payjoin, cancels the active payjoin actor with fallback, and forces a wallet scan.
Wallet deadline state and reconciliation
android/app/src/main/java/org/bitcoinppl/cove/WalletManager.kt, ios/Cove/WalletManager.swift
The mobile wallet managers store polling deadlines, clear them after errors or broadcasts, and expose cancellation.
Send-flow waiting and cancellation UI
android/app/src/main/java/org/bitcoinppl/cove/flows/SendFlow/*, ios/Cove/Flows/SendFlow/*
The send flows add waiting states, countdown banners, cancellation actions, and handling for completion or errors during polling.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Payjoin as Rust payjoin flow
  participant WalletActor
  participant WalletManager
  participant SendFlow
  participant ConfirmScreen
  Payjoin->>WalletActor: report polling deadline
  WalletActor->>WalletManager: publish PayjoinPollingStarted
  WalletManager->>SendFlow: update payjoinDeadlineSecs
  SendFlow->>ConfirmScreen: render PayjoinWaiting
  ConfirmScreen->>WalletManager: request cancelPayjoin
  WalletManager->>WalletActor: cancel active payjoin
Loading

Possibly related PRs

  • bitcoinppl/cove#423: Introduces the Android send-flow SendState and confirmation UI extended by this change.
  • bitcoinppl/cove#752: Adds the payjoin initiation flow extended with polling and cancellation handling.
  • bitcoinppl/cove#772: Adds the PayJoin flow extended with deadline state and waiting UI.

Suggested reviewers: praveenperera

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description explains the change and rationale, but it omits the required Testing section and Platform Coverage selections. Add the Testing section and select the applicable Platform Coverage option, including commands run or why testing was not needed.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely summarizes the main change: cancellable PayJoin polling with a countdown.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/payjoin-waiting-ui

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds a cancellable Payjoin polling countdown across the Rust core and both mobile clients.

  • Publishes the Payjoin polling deadline through wallet-manager reconciliation.
  • Displays waiting and countdown states on iOS and Android.
  • Cancels polling by committing and broadcasting the fallback transaction.
  • Clears waiting state after successful broadcasts and send-flow errors.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
rust/src/manager/wallet_manager/payjoin.rs Publishes polling deadlines and adds an idempotent cancellation path that completes through fallback broadcasting.
rust/src/manager/wallet_manager/actor.rs Exposes cancellation through the wallet actor and routes Payjoin failures into send-flow error reconciliation.
rust/src/manager/wallet_manager.rs Adds the polling-started reconcile event and exported cancellation method.
ios/Cove/WalletManager.swift Tracks the active Payjoin deadline and clears it on terminal broadcast and error messages.
ios/Cove/Flows/SendFlow/SendFlowConfirmScreen.swift Adds the countdown presentation, cancellation action, and waiting-state result handling.
android/app/src/main/java/org/bitcoinppl/cove/WalletManager.kt Mirrors Payjoin deadline reconciliation and cancellation support for Android.
android/app/src/main/java/org/bitcoinppl/cove/flows/SendFlow/SendFlowContainer.kt Coordinates Android waiting-state restoration, cancellation, success, and error transitions.
android/app/src/main/java/org/bitcoinppl/cove/flows/SendFlow/ConfirmScreen/SendFlowConfirmScreen.kt Renders the Android Payjoin countdown banner and cancellation control.

Sequence Diagram

sequenceDiagram
  participant UI as Mobile Send UI
  participant WM as WalletManager
  participant PA as PayjoinActor
  participant Receiver as Payjoin Receiver
  participant Node as Bitcoin Node
  PA->>Receiver: Poll for proposal
  PA->>WM: PayjoinPollingStarted(deadline)
  WM->>UI: Show countdown and cancel action
  alt Receiver supplies proposal
    PA->>Node: Broadcast Payjoin transaction
  else User cancels or deadline expires
    UI->>WM: cancelPayjoin()
    WM->>PA: cancel_and_fallback()
    PA->>Node: Broadcast fallback transaction
  end
  Node-->>WM: PayjoinTxBroadcast or SendFlowError
  WM-->>UI: Clear deadline and show result
Loading

Reviews (5): Last reviewed commit: "Add cancellable Payjoin polling countdow..." | Re-trigger Greptile

Comment thread ios/Cove/WalletManager.swift
@Sandipmandal25
Sandipmandal25 marked this pull request as draft August 6, 2026 08:33
@Sandipmandal25 Sandipmandal25 self-assigned this Aug 6, 2026
@Sandipmandal25
Sandipmandal25 force-pushed the feat/payjoin-waiting-ui branch 2 times, most recently from 04948cd to d84bdba Compare August 6, 2026 09:55
@Sandipmandal25

Copy link
Copy Markdown
Collaborator Author

@greptileai review

Comment thread ios/Cove/WalletManager.swift
@Sandipmandal25

Copy link
Copy Markdown
Collaborator Author

@greptileai re review

@Sandipmandal25

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
ios/Cove/Flows/SendFlow/SendFlowConfirmScreen.swift (1)

128-132: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Route Payjoin cancellation through WalletManager.

Line 130 calls RustWalletManager.cancelPayjoin() directly from the view. Add WalletManager.cancelPayjoin() and call that method from SendFlowConfirmScreen. Keep generated Rust access inside the platform manager boundary.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ios/Cove/Flows/SendFlow/SendFlowConfirmScreen.swift` around lines 128 - 132,
Update SendFlowConfirmScreen.cancelPayjoin() to call a new
WalletManager.cancelPayjoin() method instead of accessing manager.rust directly.
Implement WalletManager.cancelPayjoin() to delegate to the generated Rust
manager, keeping Rust access within the platform manager boundary and preserving
the existing asynchronous cancellation behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@rust/src/manager/wallet_manager/payjoin.rs`:
- Around line 582-586: The Payjoin fallback-persistence failure in
complete_with_fallback must terminate the mobile waiting state instead of
leaving payjoinDeadlineSecs set. Route the set_pending_fallback error through
the existing send-flow error channel or add a typed terminal Payjoin reconcile
event, then update both mobile wallet managers to clear the deadline and
transition the send flow out of PayjoinWaiting when handling it.

---

Nitpick comments:
In `@ios/Cove/Flows/SendFlow/SendFlowConfirmScreen.swift`:
- Around line 128-132: Update SendFlowConfirmScreen.cancelPayjoin() to call a
new WalletManager.cancelPayjoin() method instead of accessing manager.rust
directly. Implement WalletManager.cancelPayjoin() to delegate to the generated
Rust manager, keeping Rust access within the platform manager boundary and
preserving the existing asynchronous cancellation behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7d962894-7adc-4f05-a124-ba2bd9f8da60

📥 Commits

Reviewing files that changed from the base of the PR and between b7aa9fd and d84bdba.

⛔ Files ignored due to path filters (2)
  • android/app/src/main/java/org/bitcoinppl/cove_core/cove.kt is excluded by !android/app/src/main/java/org/bitcoinppl/cove_core/**
  • ios/CoveCore/Sources/CoveCore/generated/cove.swift is excluded by !**/generated/**, !ios/CoveCore/Sources/CoveCore/generated/**
📒 Files selected for processing (9)
  • android/app/src/main/java/org/bitcoinppl/cove/WalletManager.kt
  • android/app/src/main/java/org/bitcoinppl/cove/flows/SendFlow/ConfirmScreen/SendFlowConfirmScreen.kt
  • android/app/src/main/java/org/bitcoinppl/cove/flows/SendFlow/SendFlowContainer.kt
  • ios/Cove/Flows/SendFlow/ConfirmScreen/SwipeToSendView.swift
  • ios/Cove/Flows/SendFlow/SendFlowConfirmScreen.swift
  • ios/Cove/WalletManager.swift
  • rust/src/manager/wallet_manager.rs
  • rust/src/manager/wallet_manager/actor.rs
  • rust/src/manager/wallet_manager/payjoin.rs

Comment thread rust/src/manager/wallet_manager/payjoin.rs
@Sandipmandal25
Sandipmandal25 marked this pull request as ready for review August 6, 2026 10:17
@Sandipmandal25 Sandipmandal25 added the SoB-2026 Project for Summer of Bitcoin 2026 label Aug 6, 2026
@Sandipmandal25
Sandipmandal25 force-pushed the feat/payjoin-waiting-ui branch 2 times, most recently from 88a8c72 to 1ce99d3 Compare August 6, 2026 10:36
@Sandipmandal25
Sandipmandal25 force-pushed the feat/payjoin-waiting-ui branch from 1ce99d3 to b399614 Compare August 16, 2026 08:54
@Sandipmandal25

Copy link
Copy Markdown
Collaborator Author

@praveenperera rebased this pr!

@Sandipmandal25

Copy link
Copy Markdown
Collaborator Author

@greptileai review

@praveenperera
praveenperera force-pushed the feat/payjoin-waiting-ui branch 2 times, most recently from 89d8169 to 33fab44 Compare August 20, 2026 23:34
@praveenperera
praveenperera force-pushed the feat/payjoin-waiting-ui branch from 33fab44 to ee6f552 Compare August 21, 2026 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

SoB-2026 Project for Summer of Bitcoin 2026

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant