Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
c41ca5df42
  1. 16
      iguana/iguana_interpreter.c
  2. 9
      iguana/iguana_sign.c

16
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<siglen; i++)
printf("%02x",sig[i]);
printf(" sig, ");
for (i=0; i<plen; i++)
printf("%02x",pubkey[i]);
char str[65]; printf(" checksig sigtxid.%s\n",bits256_str(str,sigtxid));*/
if ( bitcoin_pubkeylen(pubkey) == plen && plen > 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<spendlen; i++)
printf("%02x",spendscript[i]);
printf(" -> (%s)\n",asmstr);
//int32_t i; for (i=0; i<spendlen; i++)
// printf("%02x",spendscript[i]);
//printf(" -> (%s)\n",asmstr);
jaddstr(spendasm,"interpreter",asmstr);
return(spendasm);
}

9
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; i<siglen; i++)
/*for (i=0; i<siglen; i++)
printf("%02x",sig[i]);
printf(" sig, ");
for (i=0; i<plen; i++)
printf("%02x",vp->signers[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 )
{

Loading…
Cancel
Save