Skip to content

Expose Sender Input Index#1432

Open
chavic wants to merge 1 commit intopayjoin:masterfrom
chavic:chavic/psbt-input-error-index-1276
Open

Expose Sender Input Index#1432
chavic wants to merge 1 commit intopayjoin:masterfrom
chavic:chavic/psbt-input-error-index-1276

Conversation

@chavic
Copy link
Copy Markdown
Collaborator

@chavic chavic commented Mar 20, 2026

Closes #1276.

This PR fixes a narrow but important sender diagnostic gap. Core sender validation already knew which original PSBT input failed validation, but that information was being discarded when the FFI converted sender build failures into a generic display string. As a result, bindings could tell that sender construction failed, but not which original input was actually invalid.

The change preserves the invalid original input index and the nested error message at the sender boundary and exposes both through the FFI BuildSenderError object. It intentionally keeps the scope tight: this does not redesign sender build errors more broadly and does not open up more of the PSBT internals than needed.

The net effect is that bindings can point directly at the failing original input instead of showing a generic sender build failure. That makes malformed PSBT diagnostics materially better without introducing a larger API redesign.

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Mar 20, 2026

Pull Request Test Coverage Report for Build 23412834694

Details

  • 22 of 24 (91.67%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.06%) to 84.186%

Changes Missing Coverage Covered Lines Changed/Added Lines %
payjoin/src/core/send/error.rs 20 22 90.91%
Totals Coverage Status
Change from base Build 23300212261: 0.06%
Covered Lines: 10674
Relevant Lines: 12679

💛 - Coveralls

chavic added a commit to chavic/rust-payjoin that referenced this pull request Mar 22, 2026
Wrap the sender-builder assertion in the Python unit test the\nway treefmt expects.\n\nThe PR was failing the formatting job on this one call site even\nthough the branch logic was already correct. Keeping the file in the\nformatter's preferred layout avoids a no-op CI failure on payjoin#1432.
Preserve the invalid-original-input index when sender build\nfailures cross the FFI boundary.\n\nThe core sender already tracks which PSBT input failed UTXO\nvalidation, but BuildSenderError was flattened to a display\nstring in payjoin-ffi. That left bindings unable to point\ncallers at the offending input without parsing error text.\n\nThis adds small core accessors for the invalid input index and\nnested message, exposes matching getters on the FFI\nBuildSenderError object, and adds a malformed-PSBT test\nfixture plus Rust, Python, and Dart regressions for the\nnon-incentivizing sender path.
@chavic chavic force-pushed the chavic/psbt-input-error-index-1276 branch from ca0af1b to e6bc04f Compare March 22, 2026 21:23
@chavic chavic requested a review from benalleng March 22, 2026 21:28
@chavic chavic self-assigned this Mar 22, 2026
@chavic chavic marked this pull request as ready for review March 22, 2026 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose PSBT input error index in FFI error types

2 participants