-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use FeeRate for max_fee_rate arg, and default it to BROADCAST_MIN #491
Conversation
Pull Request Test Coverage Report for Build 12957169876Details
💛 - Coveralls |
I believe a smoke test is preventing this from requesting review |
I don't believe we actually have the tooling to smoke test this, since the receiver max_fee_rate only comes into effect if the sender were unwilling to pay for an additional receiver input (our receiver adds one input paid for by the sender by custom), OR the receiver is batching, and payjoin CLI has no way to do either of those configurations of of the box at the moment. For this reason I believe I'd be OK merging this as-is and following up with the default fix for #489 in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the latter part of this PR addressing #489 to default to BROADCAST_MIN really ought to apply to payjoin dev kit itself in ProvisionalProposal::apply_fee
's max_feerate
passed from finalize_proposal's max_feerate_sat_per_vb
, the name being a separate problem.
I planned to just modify the sender to modify the sender to remove that contribution in order to manually test this, just haven't gotten to it yet (partly because I ignored your advice to test against the public directory, partly because i got sidetracked with other things yesterday), so please don't merge yet
So
|
I've manually tested it and appears to work, but there's one thing I'm confused about which is that with the max effective feerate set back to 0, if i chain two transactions without mining a block to confirm, the 2nd one does not get rejected. I have to go again, so I will update the PR with the bikeshedding changes later, and I will try to figure out what's going on, i suspect the effective feerate is potentially calculated incorrectly if the sender is doing CPFP |
Ah, I forgot it was mandatory, but it would make more sense to provide a sane default of BROADCAST_MIN for max_feerate if you agree it is indeed sane. CPFP is almost definitely miscalculated. not sure how we'd even deal with that or other ancestor payments without bringing in all the mempool policy stuff from core. Must that be the responsibility of the payjoin crate? Should that be the responsibility of the payjoin crate? Or can it be dealt with via a dependency somehow? |
👍, I will move BROADCAST_MIN defaulting to the payjoin crate and modify cli crate to pass None
IMO definitely not, I was just surprised that it seemed to produce the opposite of what I would have expected, namely that the receiver accepted the payjoin, so just something to investigate |
13bf515
to
9a55e8e
Compare
rebased, implemented |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions, but otherwise lgtm. I don't see a real need to squash, imo the bigger "churn" to control for is the number of times we need to go back and forth to get something merged.
payjoin/src/receive/v1/mod.rs
Outdated
@@ -829,7 +831,7 @@ pub(crate) mod test { | |||
.commit_outputs() | |||
.commit_inputs(); | |||
|
|||
let payjoin = payjoin.apply_fee(None, FeeRate::ZERO); | |||
let payjoin = payjoin.apply_fee(None, Some(FeeRate::ZERO)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not now take advantage of the default by passing None
?
I feel like our reference should take advantage of our sane defaults if we believe them to be sane.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I suppose but I also didn't want to change this test since it explicitly covers an edge case.
I guess the sensible thing is to check that both None
and Some(ZERO)
work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's reasonable. In haste I thought this was in the main payjoin-cli implementation for some reason, which is why I mentioned "reference."
i believe the reference is actually using finalize_psbt with our configured value, which is appropriate, so this comment may be disregarded.
Above and beyond would be like you said to check None
in the unit test as well.
payjoin/src/receive/v1/mod.rs
Outdated
min_feerate_sat_per_vb: Option<FeeRate>, | ||
max_feerate_sat_per_vb: FeeRate, | ||
min_feerate: Option<FeeRate>, | ||
max_effective_feerate: FeeRate, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the apply_fee
argument also be renamed to max_effective_feerate
?
There are other places we're using fee_rate
as an argument name instead of feerate
and those should be made consistent.
Fair, but since you posted some feedback if you don't mind i'm going to squash and apply that feedback |
agreed squash makes sense in this conversation |
after wasting some time doing the opposite, going with |
... with the exception of |
FeeRate's serde support is used for serialization, whereas on the command line it's parsed as a number
Also renames to max_effective_fee_rate
9a55e8e
to
5d410bf
Compare
breaking pub v1 stuff is completely fine The actual params value is |
5d410bf
to
95aaabd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 95aaabd please go ahead and merge
Tested manually by modifying the sender to zero out the additional fee contribution, sending a payment with a feerate of 1 sat/vb, with the caveat that if unconfirmed txs were in the mempool the receiver still accepted (both with and without the changes of this PR)
Closes #452
See also #489