Skip to content

Wallet: report partial mixed sends - #2012

Open
reubenyap wants to merge 1 commit into
masterfrom
wallet/mixed-send-partial-receipt
Open

reubenyap wants to merge 1 commit into
masterfrom
wallet/mixed-send-partial-receipt

Conversation

@reubenyap

@reubenyap reubenyap commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Purpose

Make partial completion visible in sendtoaddress batches with Spark and transparent recipients. The current wallet commits Spark mint transaction(s) before constructing a separate transparent transaction. If the latter fails, a Spark payment may already be committed.

For this transparent-funded mint path, consensus allows Spark mint and transparent payment outputs in one transaction. The split is in the wallet implementation; this PR does not change it.

Changes

  • Preflight the combined requested amount against the transparent balance, preventing the reproduced over-budget failure after a mint.
  • Remove a redundant Spark mint commit and include committed_txids with a retry warning when a later failure follows a known commit.
  • Cover over-budget and fee-deficient partial sends in sendtoaddress.py; update RPC help.

Verification

macOS arm64 daemon and CLI build; qa/rpc-tests/sendtoaddress.py passes on regtest.

Remaining limitation

Mixed sends still use multiple transactions and are not atomic. A later failure can leave an earlier Spark mint committed; callers must inspect committed_txids before retrying.

Preflight the combined transparent amount and include committed transaction IDs in partial-failure errors. Remove duplicate Spark mint commits and cover both budget and fee failures in the RPC test.
@codeant-ai

codeant-ai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 0f51e9e Oct 19, 2026 · 17:21 17:24

@codeant-ai

codeant-ai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T17:24:44.942333Z 0f51e9e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Oct 19, 2026
@codeant-ai

codeant-ai Bot commented Oct 19, 2026

Copy link
Copy Markdown

CodeAnt-AI Description

Show committed payment IDs when mixed wallet sends fail

What Changed

  • Mixed Spark and transparent sends that exceed the available transparent balance are rejected before either payment is sent.
  • If a payment is committed before a later step fails, the error includes its transaction ID and warns against retrying the full request.
  • Successful Spark sends return their committed transaction IDs without attempting to commit them again.

Impact

✅ No payments started for over-budget mixed sends
✅ Clear committed payment IDs after partial failures
✅ Lower duplicate-payment risk after mixed-send failures

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai

codeant-ai Bot commented Oct 19, 2026

Copy link
Copy Markdown

CodeAnt PR Risk: Medium Risk

  • The PR needs attention before merging: the simple-format Spark path no longer explicitly commits its transaction.
  • Verify that the mint routine commits before returning; otherwise this path may return a txid for a transaction that was never committed.

Assessed commit: 0f51e9e8f40f

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 650f006b-e3b2-4ef6-a41d-219325d48365
📥 Commits

Reviewing files that changed from the base of the PR and between 8246465 and 0f51e9e.

📒 Files selected for processing: 2
  • qa/rpc-tests/sendtoaddress.py
  • src/wallet/rpcwallet.cpp

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

Summary by CodeRabbit

  • Bug Fixes
    • Mixed Spark and transparent payments now reject amounts that exceed supported limits or the available transparent balance.
    • When a mixed payment fails after one or more transactions have been committed, the error reports the committed transaction IDs and warns not to retry. A committed transaction can still be retrieved using its ID.

Walkthrough

Mixed sends now validate recipient totals and available balance, track committed Spark and transparent transaction IDs, and include committed IDs in partial-failure errors. The RPC test covers an over-budget request and a fee-deficient request that fails after a transaction commits.

Changes

Mixed-send RPC handling

Layer / File(s) Summary
Mixed-send validation and error contract
src/wallet/rpcwallet.cpp
The RPC checks Spark and transparent recipient totals against MAX_MONEY, checks the combined amount against the available transparent balance, and documents committed_txids in relevant help text.
Spark and transparent transaction handling
src/wallet/rpcwallet.cpp
Spark minting relies on transactions committed by MintAndStoreSpark. The send path tracks committed IDs and includes them in errors if a later Spark or transparent operation fails.
Mixed-send failure coverage
qa/rpc-tests/sendtoaddress.py
The test checks that an over-budget request leaves the payer’s balance unchanged and that a fee-deficient request reports a retrievable committed transaction ID.

Priority: ➖ Normal

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

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant SendRPC as sendtoaddress JSON path
  participant Mint as MintAndStoreSpark
  participant Wallet
  participant TransparentSend as transparent-send path
  Caller->>SendRPC: Submit mixed-send request
  SendRPC->>Mint: Create Spark mint transactions
  Mint->>Wallet: Commit Spark mint transactions
  Wallet-->>SendRPC: Return committed Spark transaction IDs
  SendRPC->>TransparentSend: Create and commit transparent transaction
  TransparentSend->>Wallet: Commit transparent transaction
  Wallet-->>SendRPC: Return committed transaction ID
  SendRPC-->>Caller: Return transaction ID or IDs
  TransparentSend-->>SendRPC: Report failure
  SendRPC-->>Caller: Return error with committed_txids
Loading

Suggested reviewers: levonpetrosyan93

Merge Risk: ⚪ Minimal · up to 0f51e

The reviewed changes have no established issue requiring correction before merge; mixed sends remain non-atomic, and callers should check reported committed transaction IDs before retrying.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: reporting partial completion for mixed sends.
Description check Passed The description explains the purpose, implementation changes, verification, and remaining limitation. It uses different headings from the template, but it provides the required intention and code-chan…
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.
Full details: Description check

Explanation

The description explains the purpose, implementation changes, verification, and remaining limitation. It uses different headings from the template, but it provides the required intention and code-change information.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant