Print transaction purpose in toString().

This commit is contained in:
Andreas Schildbach 2015-12-17 08:57:34 +01:00
parent ab169f0700
commit 720f7d2a92
2 changed files with 6 additions and 0 deletions

View File

@ -717,6 +717,8 @@ public class Transaction extends ChildMessage {
Coin fee = getFee();
if (fee != null)
s.append(" fee ").append(fee.toFriendlyString()).append(String.format("%n"));
if (purpose != null)
s.append(" prps ").append(purpose).append(String.format("%n"));
return s.toString();
}

View File

@ -31,6 +31,7 @@ import org.bitcoinj.core.listeners.TransactionReceivedInBlockListener;
import org.bitcoinj.core.listeners.WalletEventListener;
import org.bitcoinj.core.listeners.WalletChangeEventListener;
import org.bitcoinj.core.listeners.WalletCoinEventListener;
import org.bitcoinj.core.Transaction.Purpose;
import org.bitcoinj.core.TransactionConfidence.*;
import org.bitcoinj.crypto.*;
import org.bitcoinj.params.*;
@ -3024,6 +3025,9 @@ public class Wallet extends BaseTaggableObject
builder.append(tx.getValueSentToMe(this).toFriendlyString());
builder.append(", total value ");
builder.append(tx.getValue(this).toFriendlyString());
final Purpose purpose = tx.getPurpose();
if (purpose != null)
builder.append(", purpose: ").append(purpose);
builder.append(".\n");
} catch (ScriptException e) {
// Ignore and don't print this line.