From 2cd4194a9fd4f4bf37180059fccc9d9287c89bad Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 25 Sep 2016 16:48:17 -0300 Subject: [PATCH] test --- basilisk/basilisk.h | 2 +- iguana/iguana_interpreter.c | 22 ++++++++++++++++------ iguana/tests/decoderawtransactionB | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/basilisk/basilisk.h b/basilisk/basilisk.h index 66567a7d9..0330da3e2 100755 --- a/basilisk/basilisk.h +++ b/basilisk/basilisk.h @@ -16,7 +16,7 @@ #ifndef H_BASILISK_H #define H_BASILISK_H -//#define BASILISK_DISABLESENDTX +#define BASILISK_DISABLESENDTX #define BASILISK_DISABLEWAITTX #include "../iguana/iguana777.h" diff --git a/iguana/iguana_interpreter.c b/iguana/iguana_interpreter.c index 7aab18c1c..cb671070e 100755 --- a/iguana/iguana_interpreter.c +++ b/iguana/iguana_interpreter.c @@ -1337,28 +1337,38 @@ int32_t bitcoin_assembler(struct iguana_info *coin,cJSON *logarray,uint8_t scrip } else if ( (op->flags & IGUANA_CRYPTOFLAG) != 0 ) { - uint8_t rmd160[20]; bits256 hash; + uint8_t rmd160[20],revrmd160[20]; bits256 hash,revhash; datalen = iguana_databuf(databuf,args[0]); switch ( op->opcode ) { case IGUANA_OP_RIPEMD160: - calc_rmd160(0,rmd160,databuf,datalen); + calc_rmd160(0,revrmd160,databuf,datalen); + for (i=0; i<20; i++) + rmd160[i] = revrmd160[19-i]; iguana_pushdata(stacks,0,rmd160,sizeof(rmd160)); break; case IGUANA_OP_SHA1: - calc_sha1(0,rmd160,databuf,datalen); + calc_sha1(0,revrmd160,databuf,datalen); + for (i=0; i<20; i++) + rmd160[i] = revrmd160[19-i]; iguana_pushdata(stacks,0,rmd160,sizeof(rmd160)); break; case IGUANA_OP_HASH160: - calc_rmd160_sha256(rmd160,databuf,datalen); + calc_rmd160_sha256(revrmd160,databuf,datalen); + for (i=0; i<20; i++) + rmd160[i] = revrmd160[19-i]; iguana_pushdata(stacks,0,rmd160,sizeof(rmd160)); break; case IGUANA_OP_SHA256: - vcalc_sha256(0,hash.bytes,databuf,datalen); + vcalc_sha256(0,revhash.bytes,databuf,datalen); + for (i=0; i<32; i++) + hash.bytes[i] = revhash.bytes[31-i]; iguana_pushdata(stacks,0,hash.bytes,sizeof(hash)); break; case IGUANA_OP_HASH256: - hash = bits256_doublesha256(0,databuf,datalen); + revhash = bits256_doublesha256(0,databuf,datalen); + for (i=0; i<32; i++) + hash.bytes[i] = revhash.bytes[31-i]; iguana_pushdata(stacks,0,hash.bytes,sizeof(hash)); break; case IGUANA_OP_CHECKSIG: case IGUANA_OP_CHECKSIGVERIFY: diff --git a/iguana/tests/decoderawtransactionB b/iguana/tests/decoderawtransactionB index 9293d8821..69cafff92 100755 --- a/iguana/tests/decoderawtransactionB +++ b/iguana/tests/decoderawtransactionB @@ -1 +1 @@ -curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"decoderawtransaction\",\"params\":[\"0100000021fde75701151b564fe4e5c316b331838b13600795ac981e99b950d80054c498f5ac5abf7f00000000da483045022100b038ff111f90bb62bfc59ea431c843fb60f54cab13e76cb204b4934c995f06370220466fa43979589e4cf5e9a784f3781a1f7947c14251a385305b79cf2ef86887f801483045022100e7731a9398b82c234a52538943caeaeffc8183b6ec4a42f9fe20b9cc3ba6981902200e285a7a6b3963016900c7dfbfdbc6635bdf9cdae642c9419649a70f8462f214014752210272532a1ce14bc3ee2049584b15e429fac230311f94bb43dd90b69ed3f395ec8d2103868005f78f7cafbf639257ad4173800748053a83418f0f5f472ca5b8efcb637a52aeffffffff01706f9800000000001976a9148ee61a3161993f4f7b7081259bf5f3322d65d3f888ac00000000\"]}" +curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"decoderawtransaction\",\"params\":[\"01000000171fe857014a96c1601ac7dde7e9e938576f29231ed4a118b2b5eaaf9bd67c4fba1628ee8200000000d9473044022057a2334780d4d9a3056ad94305cb791a97f93712960d3c28bd0fe7ea1a1e3dde022020d290a335f0256a883e479ce8b094b5825d7255f04e6cc932214338400d159801483045022100d95d280dee78d5898b951333e57a441c36afc22b335d17347be2ed254ed3959102202089f6461c79c056cf4ec168ee0d5e7fba88444faa790110b3ece3c4670db93e0147522102ede537352694a7bd6946dd6a0df6b1a7a9901cc62c4849761c5c3bcef36ce8ec2103e0b630d5cb045e5d3946f7135ef3598e35b07ccb68f55c3491e79f62a9192d8b52aeffffffff01706f9800000000001976a9148ee61a3161993f4f7b7081259bf5f3322d65d3f888ac00000000\"]}"