ScriptBuilder: Fix number encoding for 16. It must be encoded with smallNum().
@@ -112,7 +112,7 @@ public class ScriptBuilder {
* shortest encoding possible.
*/
public ScriptBuilder number(long num) {
- if (num >= 0 && num < 16) {
+ if (num >= 0 && num <= 16) {
return smallNum((int) num);
} else {
return bigNum(num);
@@ -124,7 +124,7 @@ public class ScriptBuilder {
* uses shortest encoding possible.
*/
public ScriptBuilder number(int index, long num) {
- if (num >= 0 && num < 16) {
+ if (num >= 0 && num <= 16) {
return addChunk(index, new ScriptChunk(Script.encodeToOpN((int) num), null));
} else {
return bigNum(index, num);
