Skip to content
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

Fix min relay fee to be 1s/vB #3457

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

arik-so
Copy link
Contributor

@arik-so arik-so commented Dec 11, 2024

Bitcoin Core relay policy does not require 16s/vB, which it was
previously set to.

This should address #3438.

@arik-so arik-so marked this pull request as draft December 11, 2024 06:49
Copy link

codecov bot commented Dec 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.71%. Comparing base (641e40f) to head (7d6b1f3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3457      +/-   ##
==========================================
+ Coverage   89.69%   89.71%   +0.01%     
==========================================
  Files         130      130              
  Lines      107614   107629      +15     
  Branches   107614   107629      +15     
==========================================
+ Hits        96528    96557      +29     
+ Misses       8678     8671       -7     
+ Partials     2408     2401       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@arik-so arik-so marked this pull request as ready for review December 12, 2024 06:12
@@ -176,7 +176,7 @@ pub trait FeeEstimator {
}

/// Minimum relay fee as required by bitcoin network mempool policy.
pub const MIN_RELAY_FEE_SAT_PER_1000_WEIGHT: u64 = 4000;
pub const MIN_RELAY_FEE_SAT_PER_1000_WEIGHT: u64 = 253;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we delete this in favor of FEERATE_FLOOR_SATS_PER_KW below ? Different types, but same number.

Copy link
Contributor Author

@arik-so arik-so Dec 19, 2024

Choose a reason for hiding this comment

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

I don't think we can, because one is the regular broadcast fee rate, and the other is the eviction/incremental fee rate per RBF rule 4 (https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff)

Copy link
Contributor Author

@arik-so arik-so Dec 19, 2024

Choose a reason for hiding this comment

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

that said, looking at these values

"mempoolminfee": 0.00001373,
"minrelaytxfee": 0.00001000,
"incrementalrelayfee": 0.00001000

I don't know when minrelaytxfee and incrementalrelayfee wouldn't align short of an explicit config change.

Copy link
Contributor

@tankyleo tankyleo Dec 19, 2024

Choose a reason for hiding this comment

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

Thank you where did you find them ? I've been grepping the bitcoin repo, can't see them.

I agree these are two different settings - I suggest we clarify one of them is the incremental fee rate, the other is the broadcast fee rate, as you've described - "MIN_RELAY_FEE" and "FEERATE_FLOOR" is a little too similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh I just called getmempoolinfo on my node's RPC lol

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fair point, honestly both names suck

Copy link
Contributor

Choose a reason for hiding this comment

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

could use the names from bitcoin core, minrelaytxfee and incrementalrelayfee

Copy link
Contributor Author

Choose a reason for hiding this comment

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

let's start with renaming minrelaytxfee to incrementalrelayfee for now, and we can get more ambitious with the other one in a separate PR

Copy link
Contributor

@morehouse morehouse left a comment

Choose a reason for hiding this comment

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

It would be good to add some unit tests for feerate_bump.

@@ -1312,18 +1312,21 @@ fn test_duplicate_htlc_different_direction_onchain() {

let chan_1 = create_announced_chan_between_nodes(&nodes, 0, 1);

let payment_value_sats = 546;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was the value changed to 546?

Also the naming is bound to cause confusion: payment_value_sats sounds like it should correspond to the same payment as the payment_preimage and payment_hash variables, but it actually is a different payment.

Also, we should define the variables closer to where they are used.

Comment on lines +1352 to +1353
assert!(claim_txn.len() >= 3);
assert!(claim_txn.len() <= 5);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the claim transactions be deterministic? Why are we accepting a range of transactions now?

It would be good to add a comment explaining the transactions expected to be broadcast.

Comment on lines +7681 to +7682
let htlc_value_a_msats = 847_000;
let htlc_value_b_msats = 546_000;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are the payment values changed?

assert_eq!(remote_txn[0].input[0].previous_output.txid, chan.3.compute_txid());
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1000000, 59000000);
let (payment_preimage, payment_hash, ..) = route_payment(&nodes[0], &[&nodes[1]], htlc_value_a_msats);
route_payment(&nodes[1], &vec!(&nodes[0])[..], htlc_value_b_msats).0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Return value is unused.

Suggested change
route_payment(&nodes[1], &vec!(&nodes[0])[..], htlc_value_b_msats).0;
route_payment(&nodes[1], &vec!(&nodes[0])[..], htlc_value_b_msats);

assert_eq!(node_txn.len(), 3);
// plus, depending on the block connection style, two further bumps
assert!(node_txn.len() >= 3);
assert!(node_txn.len() <= 6);
Copy link
Contributor

Choose a reason for hiding this comment

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

If additional bumps can occur, we should verify all of them below (not just the first bump).

// preimage and timeout sweeps from remote commitment + preimage sweep bump
assert_eq!(node_txn.len(), 3);
// plus, depending on the block connection style, two further bumps
Copy link
Contributor

Choose a reason for hiding this comment

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

So the bumping strategy can vary depending on how the user calls the block connection APIs?

How specifically is bumping affected, and could this lead to transactions not confirming in time?

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.

3 participants