Skip to content

Fix: Incorrect Fee Estimation Due to Omitted estimate_mode in Bitcoin Core 28.0#1263

Merged
NicolasDorier merged 3 commits intoMetacoSA:masterfrom
juanmigdr:incorrect-fee-estimation
May 11, 2025
Merged

Fix: Incorrect Fee Estimation Due to Omitted estimate_mode in Bitcoin Core 28.0#1263
NicolasDorier merged 3 commits intoMetacoSA:masterfrom
juanmigdr:incorrect-fee-estimation

Conversation

@juanmigdr
Copy link
Contributor

Fixes #1262

@farukterzioglu
Copy link
Collaborator

farukterzioglu commented Apr 24, 2025

LGTM It introduces a behaviour change.

The previous behaviour was:

If the user doesn't set estimateMode
use Bitcoin Core's default value.
It means;
if node < 0.28, feeMode is conservative
else if node >= 0.28, feeMode is economical

we are changing the behaviour to;

If the user doesn't set estimateMode
feeMode is set to conservative by code.
Bitcoin Core's default is ignored.

Users that don't set estimateMode and have been using node >= 0.28 will be affected by a behaviour change if we merge this as is. Their fee estimation mode will be switched from economical to conservative , while Bitcoin Core did exactly the opposite.

With the current NBitcoin version, users with a node >= 0.28 already switched to economical as expected by Bitcoin Core.
This change will revert that silently.

I suggest to change the parameter estimateMode as nullable, remove the default value, and add to the parameters if it is not null.

@juanmigdr
Copy link
Contributor Author

Thank you @farukterzioglu for your comment, I can see this will impact users already using a node with a version >= 0.28. I will make adjustments to my PR to cater for this.

@juanmigdr
Copy link
Contributor Author

I have now made changes through this commit which should cater for the following scenarios:

If the user does not set estimateMode:

  • If node < 0.28, NO estimateMode is sent in RPC -> We use default "conservative" mode - SAME
  • if node >= 0.28, 'NO estimateMode is sent in RPC -> We use default "economical" mode - SAME

If the user sets estimateMode to conservative:

  • If node < 0.28, NO estimateMode is sent in RPC -> We use default "conservative" mode - SAME OUTCOME - we just pass the estimateMode=conservative in the request
  • if node >= 0.28, 'NO estimateMode is sent in RPC -> We use default "economical" mode - DIFFERENT OUTCOME - we pass the estimateMode=conservative in the request which is then used as the estimationMode

If the user sets estimateMode to economical:

  • If node < 0.28, economical estimateMode is sent in RPC -> We use "economical" mode - SAME
  • if node >= 0.28, economical estimateMode is sent in RPC -> We use "economical" mode - SAME

@NicolasDorier NicolasDorier merged commit 9106e10 into MetacoSA:master May 11, 2025
7 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.

Incorrect Fee Estimation Due to Omitted estimate_mode in Bitcoin Core 28.0

3 participants