Remove useless default tx fee calculations

Resolves issue found during https://github.com/bisq-network/bisq/pull/4673
review, and suggested in comment
https://github.com/bisq-network/bisq/pull/4673#discussion_r510110682

Also shortened comment lines to < 90 chars.
This commit is contained in:
ghubstan 2020-10-22 10:41:04 -03:00
parent 31a311903a
commit d463dd14a0
No known key found for this signature in database
GPG key ID: E35592D6800A861E

View file

@ -123,26 +123,25 @@ public class TakeOfferModel implements Model {
} }
private void calculateTxFees() { private void calculateTxFees() {
// Taker pays 3 times the tx fee (taker fee, deposit, payout) because the mining fee might be different when maker created the offer // Taker pays 3 times the tx fee (taker fee, deposit, payout) because the mining
// and reserved his funds. Taker creates at least taker fee and deposit tx at nearly the same moment. Just the payout will // fee might be different when maker created the offer and reserved his funds.
// be later and still could lead to issues if the required fee changed a lot in the meantime. using RBF and/or // Taker creates at least taker fee and deposit tx at nearly the same moment.
// multiple batch-signed payout tx with different fees might be an option but RBF is not supported yet in BitcoinJ // Just the payout will be later and still could lead to issues if the required
// and batched txs would add more complexity to the trade protocol. // fee changed a lot in the meantime. using RBF and/or multiple batch-signed
// payout tx with different fees might be an option but RBF is not supported yet
// in BitcoinJ and batched txs would add more complexity to the trade protocol.
// A typical trade fee tx has about 260 bytes (if one input). The trade txs has about 336-414 bytes. // A typical trade fee tx has about 260 bytes (if one input). The trade txs has
// We use 320 as a average value. // about 336-414 bytes. We use 320 as a average value.
// trade fee tx: 260 bytes (1 input) // Fee calculations:
// deposit tx: 336 bytes (1 MS output+ OP_RETURN) - 414 bytes (1 MS output + OP_RETURN + change in case of smaller trade amount) // Trade fee tx: 260 bytes (1 input)
// payout tx: 371 bytes // Deposit tx: 336 bytes (1 MS output+ OP_RETURN) - 414 bytes
// disputed payout tx: 408 bytes // (1 MS output + OP_RETURN + change in case of smaller trade amount)
// Payout tx: 371 bytes
// Disputed payout tx: 408 bytes
// Set the default values (in rare cases if the fee request was not done yet we get the hard coded default values) // Request actual fees:
// But the "take offer" happens usually after that so we should have already the value from the estimation service.
txFeePerByteFromFeeService = feeService.getTxFeePerByte();
txFeeFromFeeService = offerUtil.getTxFeeBySize(txFeePerByteFromFeeService, feeTxSize);
// We request to get the actual estimated fee
log.info("Start requestTxFee: txFeeFromFeeService={}", txFeeFromFeeService); log.info("Start requestTxFee: txFeeFromFeeService={}", txFeeFromFeeService);
feeService.requestFees(() -> { feeService.requestFees(() -> {
txFeePerByteFromFeeService = feeService.getTxFeePerByte(); txFeePerByteFromFeeService = feeService.getTxFeePerByte();