Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for potentially NaN sum in subtractFee #394

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- fixed: Check for NaN target totals in `subtractFee` style transactions
- removed: Disable `accelerate` for bip44 wallets

## 2.5.3 (2024-01-24)
Expand Down
3 changes: 2 additions & 1 deletion src/common/utxobased/keymanager/utxopicker/subtractFee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export function subtractFee(args: UtxoPickerArgs): UtxoPickerResult {
outputs[0].value -= fee

const targetValue = utils.sumOrNaN(targets)
if (fee > targetValue) return { inputs: utxos, fee, changeUsed: false }
if (isNaN(targetValue) || fee > targetValue)
return { inputs: utxos, fee, changeUsed: false }

return { inputs: utxos, outputs, fee, changeUsed: false }
}
Loading