mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-14 19:25:51 +00:00
Teach TransactionOutput.toString() to print send-to-pubkey and send-to-multisig types.
This commit is contained in:
parent
c37423a737
commit
9fe8e8ee2b
@ -300,10 +300,23 @@ public class TransactionOutput extends ChildMessage implements Serializable {
|
||||
/**
|
||||
* Returns a human readable debug string.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
try {
|
||||
return "TxOut of " + Utils.bitcoinValueToFriendlyString(value) + " to " +
|
||||
getScriptPubKey().getToAddress(params).toString() + " script:" + getScriptPubKey().toString();
|
||||
Script script = getScriptPubKey();
|
||||
StringBuilder buf = new StringBuilder("TxOut of ");
|
||||
buf.append(Utils.bitcoinValueToFriendlyString(value));
|
||||
if (script.isSentToAddress() || script.isPayToScriptHash())
|
||||
buf.append(" to ").append(script.getToAddress(params));
|
||||
else if (script.isSentToRawPubKey())
|
||||
buf.append(" to pubkey ").append(Utils.bytesToHexString(script.getPubKey()));
|
||||
else if (script.isSentToMultiSig())
|
||||
buf.append(" to multisig");
|
||||
else
|
||||
buf.append(" (unknown type)");
|
||||
buf.append(" script:");
|
||||
buf.append(script);
|
||||
return buf.toString();
|
||||
} catch (ScriptException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user