kaspanet / rusty-kaspa

Kaspa full-node reference implementation and related libraries in the Rust programming language
ISC License
491 stars 155 forks source link

Track the average transaction mass throughout the mempool's lifespan #599

Open michaelsutton opened 1 week ago

michaelsutton commented 1 week ago

Tracks the average transaction mass throughout the mempool's lifespan using a decaying formulae.

The intention is to avoid sensitivity to cases where the mempool has only a few transactions with unusually high mass, which affects the fee estimation mechanism (block slots in the estimator are defined by the average mass).

By using a decaying formula over all history we get:

  1. The average reflects samples obtained over a long duration
  2. It still gives more weight to more recent samples (eventually "forgetting" old enough samples)
  3. The formula for this calculation is very simple and requires no special bookkeeping