btcs

bitcoin script parser/evaluator/compiler/decompiler
git clone git://jb55.com/btcs
Log | Files | Refs | README | LICENSE

commit 113c9b2f5164181143ddfae0b9f36eef9aeaaad5
parent 63ef5b2d998667c101829cd061fdc3d5ade7604d
Author: William Casarin <jb55@jb55.com>
Date:   Mon,  3 Jun 2019 13:15:04 -0700

fix some more issues

Diffstat:
Mscript.c | 2+-
Mtest.c | 3++-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/script.c b/script.c @@ -170,7 +170,7 @@ script_eval(const u8 *script, size_t script_size, struct stack *stack, /* if (fRequireMinimal && !CheckMinimalPush(vchPushValue, opcode)) { */ /* return set_error(serror, MINIMALDATA); */ /* } */ - stack_push_data(stack, (u8*)tmpbuf, tmplen); + stack_push_raw(stack, tmpbytes, tmplen); } else if (if_exec || (OP_IF <= opcode && opcode <= OP_ENDIF)) switch (opcode) { case OP_1NEGATE: diff --git a/test.c b/test.c @@ -140,6 +140,7 @@ TEST(test_small_int) { int len; static u8 buf[6]; static u8 expected_in[] = { 0x01, 0x7f }; + static u8 expected_out[] = { 0x7f }; script_push_int(script, 127); script_serialize(script, buf, sizeof(buf), &len); @@ -148,7 +149,7 @@ TEST(test_small_int) { script_eval(buf, sizeof(expected_in), stack, result); stack_serialize(stack, buf, sizeof(buf), &len); - cmp_data(buf, expected_in, len, sizeof(expected_in), + cmp_data(buf, expected_out, len, sizeof(expected_out), "small integer output serializes ok"); }