3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-13 02:35:52 +00:00

ScriptBuilder: convert an attempt to push an empty array into a smallNum(0) i.e. OP_0 call.

This commit is contained in:
Mike Hearn 2015-06-24 17:13:01 +02:00
parent 93fc0049f1
commit 07682145e3

View File

@ -74,7 +74,10 @@ public class ScriptBuilder {
/** Adds a copy of the given byte array as a data element (i.e. PUSHDATA) at the end of the program. */
public ScriptBuilder data(byte[] data) {
return data(chunks.size(), data);
if (data.length == 0)
return smallNum(0);
else
return data(chunks.size(), data);
}
/** Adds a copy of the given byte array as a data element (i.e. PUSHDATA) at the given index in the program. */