Skip to content

fix(kaspa): two-pass fee estimation for migration mass calculation#448

Merged
danwt merged 2 commits intomain-dymfrom
danwt/claude/fix-migration-fee-underestimate
Jan 23, 2026
Merged

fix(kaspa): two-pass fee estimation for migration mass calculation#448
danwt merged 2 commits intomain-dymfrom
danwt/claude/fix-migration-fee-underestimate

Conversation

@danwt
Copy link
Copy Markdown

@danwt danwt commented Jan 23, 2026

Summary

  • The single-pass mass estimation underestimated the fee because storage mass is C / output_amount — the actual change output (relayer_sum - fee) is smaller than relayer_sum, yielding higher mass than estimated
  • Applied the same two-pass pattern used in the withdrawal sweep flow (calculate_relayer_fee in sweep.rs)
  • Changed round() to ceil() to avoid rounding down below the required fee

Fixes: transaction has 18089 fees which is under the required amount of 18128

Test plan

  • Deploy to blumbus and re-run Phase 5 migration
  • Verify migration TX is accepted (no "fees under required amount" rejection)

🤖 Generated with Claude Code

danwt and others added 2 commits January 23, 2026 12:10
…ation

The single-pass approach underestimated the fee because storage mass is
C/output_amount — the actual change output (relayer_sum - fee) is smaller
than relayer_sum, yielding higher mass. Apply the same two-pass pattern
used in the withdrawal sweep flow, and use ceil() instead of round().

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add RELAYER_SWEEPING_PRIORITY_FEE (3000 sompi) buffer to both passes,
matching the withdrawal sweep pattern. This covers any residual
underestimation from the fee-mass feedback loop.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@danwt danwt merged commit c74808d into main-dym Jan 23, 2026
7 of 11 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.

1 participant