Skip to content

mempool: fee flow meter decays each bucket once per admit - #1341

Merged
reardencode merged 2 commits into
reardencode:masterfrom
surgecredit:fees/flow-meter-decay
Nov 2, 2026
Merged

reardencode merged 2 commits into
reardencode:masterfrom
surgecredit:fees/flow-meter-decay

Conversation

@punithbm

@punithbm punithbm commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Part of #1274: the first two points.

The flow meter behind estimatesmartfee, Electrum and Esplora counted a steady stream at about half its rate, so near targets could quote low. note_admit decayed to now, which already applies 1 - alpha to every bucket, then applied 1 - alpha to the updated bucket again. 10,000 WU every second read 5,012 WU/s after 20 half-lives and now reads 10,000.

The gap a sample is divided by was measured from the last decay, and fullness and admit_rates_wu_s decay, so a fee refresh between admits changed the next sample. The gap is now measured from the previous admit.

two_admits_pin_the_bucket_ema moves from 91 to 92: 46.0 after the first admit decays to 45.58, plus 46.0 from the second.

CPFP members at the chunk rate is not in this PR. #1333 reworks the package admit path that change goes in, so it follows once that lands.

note_admit decayed the bucket it updated, then applied the EMA's 1 - alpha
to it again, so a steady stream settled near half its rate. Reads also moved
the clock the next sample's gap was measured from. Keep a separate admit
clock for the gap and add only the new sample after the decay.

Part of reardencode#1274. The CPFP chunk rate is left for after the package admit
rework in reardencode#1333.

@rearden-grok rearden-grok Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

APPROVE. The updated bucket was decayed twice, and the sample gap followed the decay clock, so a fee refresh shortened it. note_admit now decays once, then adds sample * alpha, and takes the gap from last_admit.

Float64 recurrence of the same update: two admits move from 91.151 (rounds to 91) to 91.571 (rounds to 92). A one-second stream of 10,000 WU settles at 5011.55 under the old double decay (rounds to 5,012) and at 9999.990 after 3,000 steps of this update (rounds to 10,000). The new steady-stream and snapshot tests both fail on the old formula. The added tests are a few thousand arithmetic steps with no sleeps.

@reardencode
reardencode merged commit 8bf6a02 into reardencode:master Nov 2, 2026
21 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.

2 participants