3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-07 14:54:15 +00:00

Transaction.toString(): Don't try printing hash160 for non-address type outputs

This commit is contained in:
Mike Hearn 2014-12-09 14:23:41 +01:00
parent ab0b6d75fa
commit ef6240a8f8

View File

@ -674,8 +674,11 @@ public class Transaction extends ChildMessage implements Serializable {
s.append(outpoint.toString());
final TransactionOutput connectedOutput = outpoint.getConnectedOutput();
if (connectedOutput != null) {
Script scriptPubKey = connectedOutput.getScriptPubKey();
if (scriptPubKey.isSentToAddress() || scriptPubKey.isPayToScriptHash()) {
s.append(" hash160:");
s.append(Utils.HEX.encode(connectedOutput.getScriptPubKey().getPubKeyHash()));
s.append(Utils.HEX.encode(scriptPubKey.getPubKeyHash()));
}
}
} catch (Exception e) {
s.append("[exception: ").append(e.getMessage()).append("]");