Skip to content

Pay at least the relay floor when the backend minimum is above 1 sat/vB - #70

Merged
kwsantiago merged 4 commits into
blake2b-unifiedfrom
onchain-fee-relay-floor
Oct 26, 2026
Merged

kwsantiago merged 4 commits into
blake2b-unifiedfrom
onchain-fee-relay-floor

Conversation

@kwsantiago

@kwsantiago kwsantiago commented Oct 26, 2026 •

Copy link
Copy Markdown

When the backend's minimum relay fee is above 1 sat/vB, transactions paid at our floor feerate came out a few satoshis short and bitcoind rejected them. We round the fee down from weight, bitcoind rounds up from vsize, and FEERATE_FLOOR's slack only covers that gap at 1 sat/vB.

This adds feerate_relay_floor(), the lowest feerate that relays at a given backend minimum for any transaction weight from MINIMUM_TX_WEIGHT up, and uses it as the floor for transactions we pay for ourselves: estimates, the minimum feerate keyword, opening, mutual close, anchor fallbacks and onchain sweeps. Feerates we accept from peers still check against the raw backend minimum. At the default 1 sat/vB it returns FEERATE_FLOOR, so nothing changes there; above it, it adds about 0.75% plus 5 sat/kw.

Targets beyond 200 blocks used to return FEERATE_FLOOR regardless of the backend minimum. Delayed sweeps to our wallet always target 300 blocks out, so with a raised minimum they never relayed. They now get the relay floor too, and the onchain sweep loop stops at the relay floor rather than FEERATE_FLOOR.

Tests:

  • run-feerate_relay_floor brute-forces the bound across backend minimums and transaction weights.
  • test_penalty_htlc_min_feerate now also runs at raised minrelaytxfee values; 8 of its 10 variants failed before this change.
  • test_onchain_delayed_sweep_min_feerate fails before this change ("min relay fee not met") and passes after.

The wallet weight under-count described in #67 did not reproduce: the funding estimate matches the transaction's actual weight, so there is no change for it.

Fixes #67

Changelog-None

@kwsantiago
kwsantiago merged commit 3ffdf51 into blake2b-unified Oct 26, 2026
99 of 105 checks passed
@kwsantiago
kwsantiago deleted the onchain-fee-relay-floor branch October 26, 2026 23:00
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.

Fees at the floor feerate fall 1 to 4 sat short of bitcoind's minimum above 1 sat/vB

1 participant