3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-15 11:45:51 +00:00

Print transaction fee per kilobyte besides total fee in wallet dump.

This commit is contained in:
Andreas Schildbach 2016-02-24 15:47:22 +01:00
parent afffd8b2c7
commit cd830bb128
2 changed files with 6 additions and 4 deletions

View File

@ -693,9 +693,10 @@ public class Transaction extends ChildMessage {
} }
s.append(String.format(Locale.US, "%n")); s.append(String.format(Locale.US, "%n"));
} }
Coin fee = getFee(); final Coin fee = getFee();
if (fee != null) if (fee != null)
s.append(" fee ").append(fee.toFriendlyString()).append(String.format(Locale.US, "%n")); s.append(" fee ").append(fee.multiply(1000).divide(unsafeBitcoinSerialize().length).toFriendlyString())
.append("/kB, ").append(fee.toFriendlyString()).append(String.format(Locale.US, " total%n"));
if (purpose != null) if (purpose != null)
s.append(" prps ").append(purpose).append(String.format(Locale.US, "%n")); s.append(" prps ").append(purpose).append(String.format(Locale.US, "%n"));
return s.toString(); return s.toString();

View File

@ -4196,13 +4196,14 @@ public class Wallet extends BaseTaggableObject
signTransaction(req); signTransaction(req);
// Check size. // Check size.
int size = req.tx.bitcoinSerialize().length; final int size = req.tx.unsafeBitcoinSerialize().length;
if (size > Transaction.MAX_STANDARD_TX_SIZE) if (size > Transaction.MAX_STANDARD_TX_SIZE)
throw new ExceededMaxTransactionSize(); throw new ExceededMaxTransactionSize();
final Coin calculatedFee = req.tx.getFee(); final Coin calculatedFee = req.tx.getFee();
if (calculatedFee != null) if (calculatedFee != null)
log.info(" with a fee of {}", calculatedFee.toFriendlyString()); log.info(" with a fee of {}/kB, {} total",
calculatedFee.multiply(1000).divide(size).toFriendlyString(), calculatedFee.toFriendlyString());
// Label the transaction as being self created. We can use this later to spend its change output even before // Label the transaction as being self created. We can use this later to spend its change output even before
// the transaction is confirmed. We deliberately won't bother notifying listeners here as there's not much // the transaction is confirmed. We deliberately won't bother notifying listeners here as there's not much