Skip to content

Fall back to the node's fee estimate when mempool fees are unavailable - #664

Open
markettes wants to merge 1 commit into
mainfrom
fix/zero-mempool-feerate
Open

markettes wants to merge 1 commit into
mainfrom
fix/zero-mempool-feerate

Conversation

@markettes

Copy link
Copy Markdown
Collaborator

When mempool.space can't be reached, GetMempoolRecommendedFeesAsync returns a MempoolRecommendedFees with every fee at 0, and GetFeesByType handed that 0 back as a real rate. Callers only fall back on null, so a channel open was funded at 0 sat/vB: the change output took the whole difference and LND refused the PSBT with "input amount sum must be larger than output amount sum". The min/max feerate checks scale with that same rate, so they let it through.
GetFeesByType now returns null for any rate that isn't above zero, so every caller takes the fallback it already has: the request's own fee rate, then NBXplorer's estimate. That covers channel opens and BitcoinService withdrawals, which had the same hole; WithdrawalRequestService already guarded <= 0 on its own. In FeeRateSelector the custom value now starts at 1 sat/vB instead of 0 when mempool is down.
Nothing changes while mempool answers. No unit test: the path needs MEMPOOL_ENDPOINT, which the test project never sets.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant