Transaction: In toString(), if a script type is unknown just say so.

This commit is contained in:
Andreas Schildbach
2019-03-17 18:48:07 +01:00
parent 533d6eb1a8
commit 9d8bb0b64a

View File

@@ -808,9 +808,10 @@ public class Transaction extends ChildMessage {
ScriptType scriptType = scriptPubKey.getScriptType(); ScriptType scriptType = scriptPubKey.getScriptType();
s.append(indent).append(" "); s.append(indent).append(" ");
if (scriptType != null) if (scriptType != null)
s.append(scriptType).append(" addr:").append(scriptPubKey.getToAddress(params)) s.append(scriptType).append(" addr:").append(scriptPubKey.getToAddress(params));
.append(" "); else
s.append("outpoint:").append(outpoint).append('\n'); s.append("unknown script type");
s.append(" outpoint:").append(outpoint).append('\n');
} }
if (in.hasSequence()) { if (in.hasSequence()) {
s.append(indent).append(" sequence:").append(Long.toHexString(in.getSequenceNumber())); s.append(indent).append(" sequence:").append(Long.toHexString(in.getSequenceNumber()));
@@ -838,9 +839,12 @@ public class Transaction extends ChildMessage {
s.append(" "); s.append(" ");
s.append(out.getValue().toFriendlyString()); s.append(out.getValue().toFriendlyString());
s.append('\n'); s.append('\n');
s.append(indent).append(" ");
ScriptType scriptType = scriptPubKey.getScriptType(); ScriptType scriptType = scriptPubKey.getScriptType();
if (scriptType != null) if (scriptType != null)
s.append(indent).append(" " + scriptType + " addr:" + scriptPubKey.getToAddress(params)); s.append(scriptType).append(" addr:").append(scriptPubKey.getToAddress(params));
else
s.append("unknown script type");
if (!out.isAvailableForSpending()) { if (!out.isAvailableForSpending()) {
s.append(" spent"); s.append(" spent");
final TransactionInput spentBy = out.getSpentBy(); final TransactionInput spentBy = out.getSpentBy();