mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-14 19:25:51 +00:00
Print TX values in Wallet.toString()
This commit is contained in:
parent
0a473a8d76
commit
001afa9ae2
@ -1230,27 +1230,44 @@ public class Wallet implements Serializable {
|
||||
// Print the transactions themselves
|
||||
if (unspent.size() > 0) {
|
||||
builder.append("\nUNSPENT:\n");
|
||||
for (Transaction tx : unspent.values()) builder.append(tx);
|
||||
toStringHelper(builder, unspent);
|
||||
}
|
||||
if (spent.size() > 0) {
|
||||
builder.append("\nSPENT:\n");
|
||||
for (Transaction tx : spent.values()) builder.append(tx);
|
||||
toStringHelper(builder, spent);
|
||||
}
|
||||
if (pending.size() > 0) {
|
||||
builder.append("\nPENDING:\n");
|
||||
for (Transaction tx : pending.values()) builder.append(tx);
|
||||
toStringHelper(builder, pending);
|
||||
}
|
||||
if (inactive.size() > 0) {
|
||||
builder.append("\nINACTIVE:\n");
|
||||
for (Transaction tx : inactive.values()) builder.append(tx);
|
||||
toStringHelper(builder, inactive);
|
||||
}
|
||||
if (dead.size() > 0) {
|
||||
builder.append("\nDEAD:\n");
|
||||
for (Transaction tx : dead.values()) builder.append(tx);
|
||||
toStringHelper(builder, dead);
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private void toStringHelper(StringBuilder builder, Map<Sha256Hash, Transaction> transactionMap) {
|
||||
for (Transaction tx : transactionMap.values()) {
|
||||
try {
|
||||
builder.append("Sends ");
|
||||
builder.append(Utils.bitcoinValueToFriendlyString(tx.getValueSentFromMe(this)));
|
||||
builder.append(" and receives ");
|
||||
builder.append(Utils.bitcoinValueToFriendlyString(tx.getValueSentToMe(this)));
|
||||
builder.append(", total value ");
|
||||
builder.append(Utils.bitcoinValueToFriendlyString(tx.getValue(this)));
|
||||
builder.append(".\n");
|
||||
} catch (ScriptException e) {
|
||||
// Ignore and don't print this line.
|
||||
}
|
||||
builder.append(tx);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the {@link BlockChain} when the best chain (representing total work done) has changed. In this case,
|
||||
* we need to go through our transactions and find out if any have become invalid. It's possible for our balance
|
||||
|
Loading…
x
Reference in New Issue
Block a user