Commit 1ed53f2
fix(split): dynamic fee reserve scales with tx size (v0.1.22)
The hardcoded 200-sat fee reserve silently failed for large split counts
or wallets with many existing UTXOs. A split of 50 outputs from 8 inputs
needs ~2900 bytes of tx data, and at BSV's 100 sat/KB fee rate that's
~290 sats of fees — well over the 200 reserve. Result: the toolbox
rejected with `Insufficient funds: need X, have Y` where Y was exactly
(total_sats - 200), and the split silently failed.
Observed during the DolphinSense fleet 2026-04-15 E21-1 recovery when
topping up 5 captain wallets to 2.5M each and splitting to 50 UTXOs.
The small-count synthesis split (10 outputs) worked fine, confirming
the issue scales with output count.
Fix: compute fee reserve from estimated tx bytes (inputs × 148 +
outputs × 34 + 10) at 1 sat/byte. 1 sat/byte overshoots the actual
~0.1 sat/byte BSV miner rate by 10x — intentional generous cap so
future large splits (50+ outputs, 20+ inputs) have unambiguous
headroom. A few hundred sats of over-reserve per split is negligible
vs. the cost of failures.
Minimum floor of 500 sats so tiny splits don't race into dust.
Validated on 5 fleet captain wallets: split 50 from 2.55M sats with
8+ input UTXOs now succeeds cleanly, producing 50 × ~50,940 sat
outputs with ~2,900 sats going to miner fees.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent ef4dffd commit 1ed53f2
3 files changed
Lines changed: 27 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
73 | 93 | | |
74 | 94 | | |
75 | | - | |
| 95 | + | |
76 | 96 | | |
77 | | - | |
| 97 | + | |
| 98 | + | |
78 | 99 | | |
79 | 100 | | |
80 | 101 | | |
| |||
0 commit comments