Print byte size of transactions in wallet dump.

This commit is contained in:
Andreas Schildbach
2016-03-01 09:50:19 +01:00
parent d3f45a64cb
commit aa5684fcdf
2 changed files with 8 additions and 5 deletions

View File

@@ -692,9 +692,11 @@ public class Transaction extends ChildMessage {
s.append('\n');
}
final Coin fee = getFee();
if (fee != null)
s.append(" fee ").append(fee.multiply(1000).divide(unsafeBitcoinSerialize().length).toFriendlyString())
.append("/kB, ").append(fee.toFriendlyString()).append(" total\n");
if (fee != null) {
final int size = unsafeBitcoinSerialize().length;
s.append(" fee ").append(fee.multiply(1000).divide(size).toFriendlyString()).append("/kB, ")
.append(fee.toFriendlyString()).append(" for ").append(size).append(" bytes\n");
}
if (purpose != null)
s.append(" prps ").append(purpose).append('\n');
return s.toString();

View File

@@ -4202,8 +4202,9 @@ public class Wallet extends BaseTaggableObject
final Coin calculatedFee = req.tx.getFee();
if (calculatedFee != null)
log.info(" with a fee of {}/kB, {} total",
calculatedFee.multiply(1000).divide(size).toFriendlyString(), calculatedFee.toFriendlyString());
log.info(" with a fee of {}/kB, {} for {} bytes",
calculatedFee.multiply(1000).divide(size).toFriendlyString(), calculatedFee.toFriendlyString(),
size);
// 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