From c41ca5df42597558f756fb5ffdc036fe199fa078 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 6 May 2016 14:47:44 -0500 Subject: [PATCH] test --- iguana/iguana_interpreter.c | 16 +++++++++++----- iguana/iguana_sign.c | 9 ++++++--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/iguana/iguana_interpreter.c b/iguana/iguana_interpreter.c index 908ebf15b..36dad141d 100755 --- a/iguana/iguana_interpreter.c +++ b/iguana/iguana_interpreter.c @@ -704,13 +704,19 @@ void iguana_stack(struct iguana_interpreter *stacks,struct iguana_stackdata *arg } } -int32_t iguana_checksig(struct iguana_info *coin,struct iguana_stackdata pubkeyarg,struct iguana_stackdata sigarg,bits256 txhash2) +int32_t iguana_checksig(struct iguana_info *coin,struct iguana_stackdata pubkeyarg,struct iguana_stackdata sigarg,bits256 sigtxid) { uint8_t pubkey[MAX_SCRIPT_ELEMENT_SIZE],sig[MAX_SCRIPT_ELEMENT_SIZE]; int32_t plen,siglen; plen = iguana_databuf(pubkey,pubkeyarg); siglen = iguana_databuf(sig,sigarg); + /*int32_t i; for (i=0; i 0 && siglen > 0 && siglen < 74 ) - return(bitcoin_verify(coin->ctx,sig,siglen,txhash2,pubkey,plen) == 0); + return(bitcoin_verify(coin->ctx,sig,siglen-1,sigtxid,pubkey,plen) == 0); return(0); } @@ -878,9 +884,9 @@ cJSON *iguana_spendasm(struct iguana_info *coin,uint8_t *spendscript,int32_t spe { char asmstr[IGUANA_MAXSCRIPTSIZE*2+1]; cJSON *spendasm = cJSON_CreateObject(); iguana_expandscript(coin,asmstr,sizeof(asmstr),spendscript,spendlen); - int32_t i; for (i=0; i (%s)\n",asmstr); + //int32_t i; for (i=0; i (%s)\n",asmstr); jaddstr(spendasm,"interpreter",asmstr); return(spendasm); } diff --git a/iguana/iguana_sign.c b/iguana/iguana_sign.c index b1b6e068c..c3eebe98c 100755 --- a/iguana/iguana_sign.c +++ b/iguana/iguana_sign.c @@ -619,7 +619,7 @@ int32_t iguana_msgtx_Vset(struct iguana_info *coin,uint8_t *serialized,int32_t m int32_t bitcoin_verifyvins(struct iguana_info *coin,bits256 *signedtxidp,char **signedtx,struct iguana_msgtx *msgtx,uint8_t *serialized,int32_t maxlen,struct vin_info *V,int32_t sighash) { - bits256 sigtxid; uint8_t *sig; struct vin_info *vp; char vpnstr[64]; int32_t complete=0,plen,i,j,vini=0,flag=0,siglen,numvouts,numsigs; + bits256 sigtxid; uint8_t *sig; struct vin_info *vp; char vpnstr[64]; int32_t complete=0,plen,j,vini=0,flag=0,siglen,numvouts,numsigs; numvouts = msgtx->tx_out; vpnstr[0] = 0; *signedtx = 0; @@ -642,10 +642,13 @@ int32_t bitcoin_verifyvins(struct iguana_info *coin,bits256 *signedtxidp,char ** bitcoin_pubkey33(coin->ctx,vp->signers[j].pubkey,vp->signers[j].privkey); sig[siglen++] = sighash; vp->signers[j].siglen = siglen; - for (i=0; isigners[j].pubkey[i]);*/ // s2 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1; - printf(" SIGNEDTX.[%02x] siglen.%d\n",sig[siglen-1],siglen); + char str[65]; printf(" SIGNEDTX.[%02x] siglen.%d sigtxid.%s\n",sig[siglen-1],siglen,bits256_str(str,sigtxid)); } if ( sig == 0 || siglen == 0 ) {