Skip to content

fix Params lint error#1163

Closed
Mshehu5 wants to merge 1 commit intopayjoin:masterfrom
Mshehu5:fix_params_lint_error
Closed

fix Params lint error#1163
Mshehu5 wants to merge 1 commit intopayjoin:masterfrom
Mshehu5:fix_params_lint_error

Conversation

@Mshehu5
Copy link
Contributor

@Mshehu5 Mshehu5 commented Oct 16, 2025

This PR Closes #1162

Problem

The function identify_receiver_outputs was modifying a local copy of params but never using the modified version, causing a linter error. The issue was that the function signature only returned Vec<usize> (the owned_vouts), so the modified params were lost.

This also stops the lint and lint ffi test workflow to fail

Looking at the logic, it looks like the intention was to modify the params to remove the additional_fee_contribution if it points to a receiver output. However, since the function couldn't return the modified params, the modification was useless.

Solution

  • Changed the return type of identify_receiver_outputs from Result<Vec<usize>, Error> to Result<(Vec<usize>, Self), Error> to return both the owned vouts and the filtered payload.

  • Created variable original_payload by constructing a new Self instance with the modified params

  • Updated the return statement** to return both values

  • Updated all callers in the codebase to handle the new return type In v1/mod.rs,In v2/mod.rs

the lint test also passes in my branch test workflow : https://github.com/Mshehu5/rust-payjoin/actions/runs/18546726647

Please confirm the following before requesting review:

@coveralls
Copy link
Collaborator

coveralls commented Oct 16, 2025

Pull Request Test Coverage Report for Build 18551723885

Details

  • 12 of 19 (63.16%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.005%) to 83.742%

Changes Missing Coverage Covered Lines Changed/Added Lines %
payjoin/src/core/receive/v2/mod.rs 6 13 46.15%
Totals Coverage Status
Change from base Build 18413003453: 0.005%
Covered Lines: 8957
Relevant Lines: 10696

💛 - Coveralls

The function was modifying a local copy of params but never using the
modified version, causing a linter error.
@Mshehu5 Mshehu5 force-pushed the fix_params_lint_error branch from 1584feb to 9a3f8c8 Compare October 16, 2025 05:54
@benalleng
Copy link
Collaborator

Have we considered not just allowing mut self in the function definitions?

@Mshehu5
Copy link
Contributor Author

Mshehu5 commented Oct 16, 2025

Have we considered not just allowing mut self in the function definitions?

Thank you for the insight !
yeah seems that's a simpler way to solve it
but will this have any effect on the state machine by making mut self in the function mutable ?

@benalleng
Copy link
Collaborator

Yeah, this obviously is something to consider as this is a pub fn, perhaps others have some stronger opinions if this is a no go.

@spacebear21 spacebear21 mentioned this pull request Oct 21, 2025
2 tasks
@Mshehu5 Mshehu5 closed this Oct 21, 2025
@Mshehu5 Mshehu5 deleted the fix_params_lint_error branch October 27, 2025 16:34
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.

Newest rust nightly has new error

3 participants