Skip to content

Commit

Permalink
Add an extra byte to fee calculation to prevent rounding down
Browse files Browse the repository at this point in the history
  • Loading branch information
wiz committed Oct 10, 2019
1 parent 7bed73e commit 531db83
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/src/main/java/bisq/core/btc/wallet/BtcWalletService.java
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ public Transaction getFeeEstimationTransaction(String fromAddress,
SendRequest sendRequest = getSendRequest(fromAddress, toAddress, amount, fee, aesKey, context);
wallet.completeTx(sendRequest);
tx = sendRequest.tx;
txSize = tx.bitcoinSerialize().length;
txSize = tx.bitcoinSerialize().length + 1; // add an extra satoshi for rounding bug
printTx("FeeEstimationTransaction", tx);
}
while (feeEstimationNotSatisfied(counter, tx));
Expand Down Expand Up @@ -945,7 +945,7 @@ public Transaction getFeeEstimationTransactionForMultipleAddresses(Set<String> f
SendRequest sendRequest = getSendRequestForMultipleAddresses(fromAddresses, dummyReceiver, amount, fee, null, aesKey);
wallet.completeTx(sendRequest);
tx = sendRequest.tx;
txSize = tx.bitcoinSerialize().length;
txSize = tx.bitcoinSerialize().length + 1; // add an extra satoshi for rounding bug
printTx("FeeEstimationTransactionForMultipleAddresses", tx);
}
while (feeEstimationNotSatisfied(counter, tx));
Expand Down Expand Up @@ -983,7 +983,7 @@ public int getEstimatedFeeTxSize(List<Coin> outputValues, Coin txFee)
sendRequest.ensureMinRequiredFee = false;
sendRequest.changeAddress = dummyAddress;
wallet.completeTx(sendRequest);
return transaction.bitcoinSerialize().length;
return transaction.bitcoinSerialize().length + 1; // add an extra satoshi for rounding bug
}


Expand Down

0 comments on commit 531db83

Please sign in to comment.