From 9663629e344ad19f5eb550f6d87bd27048f3704e Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Thu, 20 Aug 2020 12:29:50 +0200 Subject: [PATCH] match coldcard fee percent calc --- .../com/sparrowwallet/drongo/wallet/WalletTransaction.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/sparrowwallet/drongo/wallet/WalletTransaction.java b/src/main/java/com/sparrowwallet/drongo/wallet/WalletTransaction.java index 1be8a4e..d55bd82 100644 --- a/src/main/java/com/sparrowwallet/drongo/wallet/WalletTransaction.java +++ b/src/main/java/com/sparrowwallet/drongo/wallet/WalletTransaction.java @@ -86,8 +86,12 @@ public class WalletTransaction { return selectedUtxos.keySet().stream().mapToLong(BlockTransactionHashIndex::getValue).sum(); } + /** + * Fee percentage matches the Coldcard implementation of total fee as a percentage of total value out + * @return the fee percentage + */ public double getFeePercentage() { - return (double)getFee() / getTotal(); + return (double)getFee() / (getTotal() - getFee()); } public boolean isCoinControlUsed() {