mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-10 08:27:04 +00:00
meltToLightning selects proofs covering amount+fee_reserve and, on overshoot, swaps them down to exactly that before melting. But the melt mints its inputs on the active keyset and the mint then charges its own NUT-02 input fee on them — which the swap-down target didn't include. On a fee-charging mint (mint.coinos.io active keyset = 100 ppk) the melt was left a sat short and threw "Inputs total X < required Y", so fixing the per-keyset swap fee alone just moved the failure from the swap to the melt. Reserve activeKeysetInputFeeFor(required) on top of amount+fee_reserve for both proof selection and the swap-down target so the subsequent melt has room for its input fee. Also fix the reported fee in MeltCompleted: the pre-paid swap "keep" was split off before the melt and never spent, so subtract it instead of counting the whole selected total minus change (which overstated fees by the keep amount in the swap path). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Ffjz3doZ5CtFtAWSpvmqR