Files
mkstack/.agents
Alex Gleason 1f37bf4aa7 Reject implausible fee rates in the onchain-bitcoin skill
`getFeeRates` coerced the remote response with `Math.ceil(data['1'] || 1)`.
`||` only catches falsy values, so a missing key was safe but a truthy
non-number — `{"1": "5"}`, `{"1": {"fee": 5}}`, what an API-version
mismatch produces — yielded NaN.

NaN then passed every downstream guard, because they are all `<` / `>=`
comparisons and every comparison with NaN is false: no change output was
added, the balance check passed, nothing threw, and the UI showed
"Fee 0" because `!NaN` is true. The wallet built a valid, broadcastable
transaction paying its entire balance to miners.

Sanitize each rate to a finite number in [1, 5000], and make `estimateFee`
throw on a non-finite rate rather than propagate NaN into the builder.
2026-08-19 10:41:01 -05:00
..