public override string ToString()
{
lock (this)
{
var builder = new StringBuilder();
builder.AppendFormat("Wallet containing {0} BTC in:", Utils.BitcoinValueToFriendlyString(GetBalance())).AppendLine();
builder.AppendFormat(" {0} unspent transactions", Unspent.Count).AppendLine();
builder.AppendFormat(" {0} spent transactions", Spent.Count).AppendLine();
builder.AppendFormat(" {0} pending transactions", Pending.Count).AppendLine();
builder.AppendFormat(" {0} inactive transactions", _inactive.Count).AppendLine();
builder.AppendFormat(" {0} dead transactions", _dead.Count).AppendLine();
// Do the keys.
builder.AppendLine().AppendLine("Keys:");
foreach (var key in Keychain)
{
builder.Append(" addr:");
builder.Append(key.ToAddress(_params));
builder.Append(" ");
builder.Append(key.ToString());
builder.AppendLine();
}
// Print the transactions themselves
if (Unspent.Count > 0)
{
builder.AppendLine().AppendLine("UNSPENT:");
foreach (var tx in Unspent.Values) builder.Append(tx);
}
if (Spent.Count > 0)
{
builder.AppendLine().AppendLine("SPENT:");
foreach (var tx in Spent.Values) builder.Append(tx);
}
if (Pending.Count > 0)
{
builder.AppendLine().AppendLine("PENDING:");
foreach (var tx in Pending.Values) builder.Append(tx);
}
if (_inactive.Count > 0)
{
builder.AppendLine().AppendLine("INACTIVE:");
foreach (var tx in _inactive.Values) builder.Append(tx);
}
if (_dead.Count > 0)
{
builder.AppendLine().AppendLine("DEAD:");
foreach (var tx in _dead.Values) builder.Append(tx);
}
return builder.ToString();
}
}