mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-02 13:37:24 +00:00
Script: An empty script will return <empty> in toString().
This commit is contained in:
@@ -31,7 +31,6 @@ import org.bitcoinj.utils.ExchangeRate;
|
|||||||
import org.bitcoinj.wallet.Wallet;
|
import org.bitcoinj.wallet.Wallet;
|
||||||
import org.bitcoinj.wallet.WalletTransaction.Pool;
|
import org.bitcoinj.wallet.WalletTransaction.Pool;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
import com.google.common.primitives.Longs;
|
import com.google.common.primitives.Longs;
|
||||||
@@ -751,8 +750,7 @@ public class Transaction extends ChildMessage {
|
|||||||
s.append("in ");
|
s.append("in ");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String scriptSigStr = in.getScriptSig().toString();
|
s.append(in.getScriptSig());
|
||||||
s.append(!Strings.isNullOrEmpty(scriptSigStr) ? scriptSigStr : "<no scriptSig>");
|
|
||||||
final Coin value = in.getValue();
|
final Coin value = in.getValue();
|
||||||
if (value != null)
|
if (value != null)
|
||||||
s.append(" ").append(value.toFriendlyString());
|
s.append(" ").append(value.toFriendlyString());
|
||||||
|
|||||||
@@ -143,11 +143,14 @@ public class Script {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the program opcodes as a string, for example "[1234] DUP HASH160"
|
* Returns the program opcodes as a string, for example "[1234] DUP HASH160", or "<empty>".
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Utils.SPACE_JOINER.join(chunks);
|
if (!chunks.isEmpty())
|
||||||
|
return Utils.SPACE_JOINER.join(chunks);
|
||||||
|
else
|
||||||
|
return "<empty>";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the serialized program as a newly created byte array. */
|
/** Returns the serialized program as a newly created byte array. */
|
||||||
|
|||||||
Reference in New Issue
Block a user