btcs

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

commit 70fb50ba8ea67b45281813d6a3effb22fd2a4464
parent 0ea47a971c82e357eef307893d80f2bd00f6f2cc
Author: William Casarin <jb55@jb55.com>
Date:   Mon,  3 Jun 2019 12:15:08 -0700

Revert "fix various issues"

This reverts commit 0ea47a971c82e357eef307893d80f2bd00f6f2cc.

Diffstat:
Mmph-opcodes | 8++++----
Mscript.c | 1-
Mtest.c | 6+++---
3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/mph-opcodes b/mph-opcodes @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python # Easy Perfect Minimal Hashing # By Steve Hanov. Released to the public domain. # @@ -40,7 +40,7 @@ def CreateMinimalPerfectHash( dict ): # Step 2: Sort the buckets and process the ones with the most items first. buckets.sort( key=len, reverse=True ) - for b in range( size ): + for b in xrange( size ): bucket = buckets[b] if len(bucket) <= 1: break @@ -68,10 +68,10 @@ def CreateMinimalPerfectHash( dict ): # placing them into a free slot. Use a negative value of d to indicate # this. freelist = [] - for i in range(size): + for i in xrange(size): if values[i] == None: freelist.append( i ) - for b in range( b, size ): + for b in xrange( b, size ): bucket = buckets[b] if len(bucket) == 0: break slot = freelist.pop() diff --git a/script.c b/script.c @@ -812,5 +812,4 @@ script_serialize(struct stack *stack, u8 *buf, int buflen, int* len) { void script_handle_input(struct stack *stack, const char *str) { - fprintf(stderr, "INPUT %s\n", str); } diff --git a/test.c b/test.c @@ -19,8 +19,8 @@ typedef void (program)(struct stack *script, struct stack *stack,\ static void cmp_data(const u8 *a, const u8 *b, int alen, int blen, const char *msg) { + int i = 0; if (memcmp(a, b, blen) != 0) { - int i = 0; printf("#\n# Failed data cmp test\n# > "); for (i = 0; i < alen; ++i) printf("%02x ", a[i] & 0xff); @@ -97,7 +97,7 @@ TEST(negative_integer) { static u8 buf[6]; int len; u8 in_script[] = { 0x01, 0x82 }; - script_eval(in_script, ARRAY_SIZE(in_script), stack, result); + int res = script_eval(in_script, ARRAY_SIZE(in_script), stack, result); script_serialize(stack, buf, ARRAY_SIZE(buf), &len); cmp_data(buf, in_script, len, ARRAY_SIZE(in_script), "negative 2 serializes ok"); } @@ -107,7 +107,7 @@ TEST(add_negative_two) { int len; static u8 in_script[] = { 0x01, 0x82, 0x01, 0x82, OP_ADD }; static u8 expected_out[] = { 0x01, 0x84 }; - script_eval(in_script, ARRAY_SIZE(in_script), stack, result); + int res = script_eval(in_script, ARRAY_SIZE(in_script), stack, result); script_serialize(stack, buf, ARRAY_SIZE(buf), &len); cmp_data(buf, expected_out, len, ARRAY_SIZE(expected_out), "add negative two twice"); }