Print more information in Transaction/Wallet toString outputs to reflect last seen block hash and confidence/depth data.

This commit is contained in:
Mike Hearn
2012-06-03 14:20:42 +02:00
parent 5deecef64c
commit cd5431b310
3 changed files with 7 additions and 9 deletions

View File

@@ -522,13 +522,12 @@ public class Transaction extends ChildMessage implements Serializable {
}
/**
* @return A human readable version of the transaction useful for debugging.
* A human readable version of the transaction useful for debugging. The format is not guaranteed to be stable.
*/
public String toString() {
// Basic info about the tx.
StringBuffer s = new StringBuffer();
s.append(" ");
s.append(getHashAsString());
s.append("\n");
s.append(String.format(" %s: %s\n", getHashAsString(), getConfidence()));
if (inputs.size() == 0) {
s.append(" INCOMPLETE: No inputs!\n");
return s.toString();

View File

@@ -277,13 +277,11 @@ public class TransactionConfidence implements Serializable {
case NOT_SEEN_IN_CHAIN:
builder.append("Not seen in chain.");
break;
case BUILDING:
builder.append("Appeared in best chain at height ");
builder.append(getAppearedAtChainHeight());
builder.append(".");
case BUILDING:
builder.append(String.format("Appeared in best chain at height %d, depth %d, work done %s.",
getAppearedAtChainHeight(), getDepthInBlocks(), getWorkDone()));
break;
}
return builder.toString();
}

View File

@@ -1327,6 +1327,7 @@ public class Wallet implements Serializable {
builder.append(String.format(" %d pending transactions\n", pending.size()));
builder.append(String.format(" %d inactive transactions\n", inactive.size()));
builder.append(String.format(" %d dead transactions\n", dead.size()));
builder.append(String.format("Last seen best block: %s\n", getLastBlockSeenHash()));
// Do the keys.
builder.append("\nKeys:\n");
for (ECKey key : keychain) {