Skip to content

Implement input/output ownership receiver state checks#7

Merged
arminsabouri merged 1 commit intopayjoin:payjoin-v4from
benalleng:payjoin-v4-state-check
Jul 24, 2025
Merged

Implement input/output ownership receiver state checks#7
arminsabouri merged 1 commit intopayjoin:payjoin-v4from
benalleng:payjoin-v4-state-check

Conversation

@benalleng
Copy link

@benalleng benalleng commented Jul 14, 2025

This implements the state checks for check_inputs_not_owned and identify_receiver_outputs I have left check_inputs_not_seen_before as there is a new table we need to add to keep track of these inputs.

@benalleng benalleng force-pushed the payjoin-v4-state-check branch 3 times, most recently from 4c1dc76 to b0a1463 Compare July 15, 2025 16:43
Comment on lines 113 to 115
.check_no_inputs_seen_before(|outpoint| {
let seen = db_conn
.coins_by_outpoints(&[*outpoint])
.contains_key(outpoint);
Copy link
Collaborator

Choose a reason for hiding this comment

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

For this check we may need to setup another table. i.e save the outpoints for a proposal after this check. And then refrence that table in this closure. Similar to what payjoin-cli does.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd say lets keep this PR lean and perform the other two checks. This one can be left as a follow up

@benalleng benalleng force-pushed the payjoin-v4-state-check branch 4 times, most recently from 319d230 to 45fda8a Compare July 16, 2025 15:18
@benalleng benalleng changed the title Payjoin v4 state check Implement input ownership receiver state checks Jul 16, 2025
@benalleng benalleng changed the title Implement input ownership receiver state checks Implement input/output ownership receiver state checks Jul 16, 2025
@benalleng benalleng marked this pull request as ready for review July 16, 2025 15:20
@benalleng
Copy link
Author

Ideally I think we should wait on payjoin/rust-payjoin#883 so we don't get so many changes in the cargo toml here and we can keep it pointed to a branch at least somewhat consistently

@benalleng benalleng mentioned this pull request Jul 16, 2025
@benalleng benalleng force-pushed the payjoin-v4-state-check branch from 45fda8a to 4847e9a Compare July 17, 2025 11:39
@benalleng benalleng force-pushed the payjoin-v4-state-check branch from 4847e9a to 7d30c94 Compare July 24, 2025 17:42
Directly reference data made available within liana and do not actually
use the closure that calls out to rust-payjoin.
@benalleng benalleng force-pushed the payjoin-v4-state-check branch from 7d30c94 to 81d4cde Compare July 24, 2025 17:42
Copy link
Collaborator

@arminsabouri arminsabouri left a comment

Choose a reason for hiding this comment

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

utACK

let proposal = proposal
.identify_receiver_outputs(|_| Ok(true))
.identify_receiver_outputs(|script| {
let address = bitcoin::Address::from_script(script, db_conn.network()).unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unwrap here is ok bc we need to do a larger error type refactor. But it can be trivially replaced with ? bc the error type in Box dyn error

@arminsabouri arminsabouri merged commit dc9aefd into payjoin:payjoin-v4 Jul 24, 2025
1 of 2 checks passed
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.

2 participants