mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 23:03:04 +00:00
Wallet: Print Wallet extensions in toString() and make tx printouts optional.
This commit is contained in:
parent
89b6b54d24
commit
d3842cc0f4
@ -2131,16 +2131,18 @@ public class Wallet implements Serializable, BlockChainListener, PeerFilterProvi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toString(false, null);
|
return toString(false, true, true, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats the wallet as a human readable piece of text. Intended for debugging, the format is not meant to be
|
* Formats the wallet as a human readable piece of text. Intended for debugging, the format is not meant to be
|
||||||
* stable or human readable.
|
* stable or human readable.
|
||||||
* @param includePrivateKeys Whether raw private key data should be included.
|
* @param includePrivateKeys Whether raw private key data should be included.
|
||||||
|
* @param includeTransactions Whether to print transaction data.
|
||||||
|
* @param includeExtensions Whether to print extension data.
|
||||||
* @param chain If set, will be used to estimate lock times for block timelocked transactions.
|
* @param chain If set, will be used to estimate lock times for block timelocked transactions.
|
||||||
*/
|
*/
|
||||||
public String toString(boolean includePrivateKeys, AbstractBlockChain chain) {
|
public String toString(boolean includePrivateKeys, boolean includeTransactions, boolean includeExtensions, AbstractBlockChain chain) {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
@ -2163,23 +2165,31 @@ public class Wallet implements Serializable, BlockChainListener, PeerFilterProvi
|
|||||||
builder.append(includePrivateKeys ? key.toStringWithPrivate() : key.toString());
|
builder.append(includePrivateKeys ? key.toStringWithPrivate() : key.toString());
|
||||||
builder.append("\n");
|
builder.append("\n");
|
||||||
}
|
}
|
||||||
|
if (includeTransactions) {
|
||||||
// Print the transactions themselves
|
// Print the transactions themselves
|
||||||
if (unspent.size() > 0) {
|
if (unspent.size() > 0) {
|
||||||
builder.append("\nUNSPENT:\n");
|
builder.append("\n>>> UNSPENT:\n");
|
||||||
toStringHelper(builder, unspent, chain);
|
toStringHelper(builder, unspent, chain);
|
||||||
}
|
}
|
||||||
if (spent.size() > 0) {
|
if (spent.size() > 0) {
|
||||||
builder.append("\nSPENT:\n");
|
builder.append("\n>>> SPENT:\n");
|
||||||
toStringHelper(builder, spent, chain);
|
toStringHelper(builder, spent, chain);
|
||||||
}
|
}
|
||||||
if (pending.size() > 0) {
|
if (pending.size() > 0) {
|
||||||
builder.append("\nPENDING:\n");
|
builder.append("\n>>> PENDING:\n");
|
||||||
toStringHelper(builder, pending, chain);
|
toStringHelper(builder, pending, chain);
|
||||||
}
|
}
|
||||||
if (dead.size() > 0) {
|
if (dead.size() > 0) {
|
||||||
builder.append("\nDEAD:\n");
|
builder.append("\n>>> DEAD:\n");
|
||||||
toStringHelper(builder, dead, chain);
|
toStringHelper(builder, dead, chain);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (includeExtensions && extensions.size() > 0) {
|
||||||
|
builder.append("\n>>> EXTENSIONS:\n");
|
||||||
|
for (WalletExtension extension : extensions.values()) {
|
||||||
|
builder.append(extension).append("\n\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
} finally {
|
} finally {
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
@ -758,6 +758,6 @@ public class WalletTool {
|
|||||||
// there just for the dump case.
|
// there just for the dump case.
|
||||||
if (chainFileName.exists())
|
if (chainFileName.exists())
|
||||||
setup();
|
setup();
|
||||||
System.out.println(wallet.toString(true, chain));
|
System.out.println(wallet.toString(true, true, true, chain));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user