Browse Source

Test

etomic
jl777 7 years ago
parent
commit
32fbae7188
  1. 21
      iguana/exchanges/LP_bitcoin.c
  2. 10
      iguana/exchanges/LP_transaction.c

21
iguana/exchanges/LP_bitcoin.c

@ -2347,7 +2347,6 @@ int32_t bitcoin_scriptget(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint32_
*userdatap = 0;
*userdatalenp = *pubkeysizep = *sigsizep = 0;
*hashtypep = SIGHASH_ALL;
printf("siglen.%d\n",scriptsig[0]);
while ( (siglen= scriptsig[n]) >= 70 && siglen <= 73 && n+siglen < len && j < 16 )
{
vp->signers[j].siglen = siglen;
@ -2356,11 +2355,11 @@ int32_t bitcoin_scriptget(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint32_
*hashtypep = vp->signers[j].sig[siglen-1];
else if ( vp->signers[j].sig[siglen-1] != (*hashtypep & (~SIGHASH_FORKID)) )
{
printf("SIGHASH.%d mismatch %d vs %d\n",j,vp->signers[j].sig[siglen-1],*hashtypep);
//printf("SIGHASH.%d mismatch %d vs %d\n",j,vp->signers[j].sig[siglen-1],*hashtypep);
break;
}
(*sigsizep) += siglen;
printf("sigsize %d [%02x]\n",*sigsizep,vp->signers[j].sig[siglen-1]);
//printf("sigsize %d [%02x]\n",*sigsizep,vp->signers[j].sig[siglen-1]);
n += (siglen + 1);
j++;
if ( spendtype == 0 && j > 1 )
@ -3295,9 +3294,9 @@ bits256 bitcoin_sigtxid(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t i
{
dest.vins[i].vinscript = spendscript;
dest.vins[i].scriptlen = spendlen;
int32_t j; for (j=0; j<spendlen; j++)
printf("%02x",spendscript[j]);
printf(" tmpscript.%d vini.%d\n",spendlen,vini);
//int32_t j; for (j=0; j<spendlen; j++)
// printf("%02x",spendscript[j]);
//printf(" tmpscript.%d vini.%d\n",spendlen,vini);
}
else
{
@ -3310,9 +3309,9 @@ bits256 bitcoin_sigtxid(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t i
dest.vins[i].userdatalen = 0;
}
len = iguana_rwmsgtx(taddr,pubtype,p2shtype,isPoS,height,1,0,serialized,maxlen,&dest,&txid,vpnstr,0,0,0,suppress_pubkeys,zcash);
for (i=0; i<len; i++)
printf("%02x",serialized[i]);
printf(" <- sigtx len.%d supp.%d user[0].%d\n",len,suppress_pubkeys,dest.vins[0].userdatalen);
//for (i=0; i<len; i++)
// printf("%02x",serialized[i]);
//printf(" <- sigtx len.%d supp.%d user[0].%d\n",len,suppress_pubkeys,dest.vins[0].userdatalen);
if ( len > 0 ) // (dest.tx_in != 1 || bits256_nonz(dest.vins[0].prev_hash) != 0) && dest.vins[0].scriptlen > 0 &&
{
#ifdef BTC2_VERSION
@ -3323,7 +3322,7 @@ bits256 bitcoin_sigtxid(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t i
revsigtxid = bits256_doublesha256(0,serialized,len);
for (i=0; i<sizeof(revsigtxid); i++)
sigtxid.bytes[31-i] = revsigtxid.bytes[i];
char str[65]; printf("SIGTXID.(%s) numvouts.%d\n",bits256_str(str,sigtxid),dest.tx_out);
//char str[65]; printf("SIGTXID.(%s) numvouts.%d\n",bits256_str(str,sigtxid),dest.tx_out);
}
free(dest.vins);
free(dest.vouts);
@ -3411,7 +3410,7 @@ int32_t iguana_rwmsgtx(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t is
}
for (i=0; i<msg->tx_in; i++)
{
printf("vin.%d starts offset.%d numvins.%d\n",i,len,msg->tx_in);
//printf("vin.%d starts offset.%d numvins.%d\n",i,len,msg->tx_in);
if ( vins != 0 && jitem(vins,i) != 0 )
iguana_vinobjset(&msg->vins[i],jitem(vins,i),spendscript,sizeof(spendscript));
if ( (n= iguana_vinparse(rwflag,&serialized[len],&msg->vins[i])) < 0 )

10
iguana/exchanges/LP_transaction.c

@ -402,7 +402,7 @@ int32_t bitcoin_verifyvins(void *ctx,char *symbol,uint8_t taddr,uint8_t pubtype,
vpnstr[0] = 0;
*signedtx = 0;
memset(signedtxidp,0,sizeof(*signedtxidp));
printf("bitcoin_verifyvins numvins.%d numvouts.%d\n",msgtx->tx_in,numvouts);
//printf("bitcoin_verifyvins numvins.%d numvouts.%d\n",msgtx->tx_in,numvouts);
for (vini=0; vini<msgtx->tx_in; vini++)
{
if ( V->p2shscript[0] != 0 && V->p2shlen != 0 )
@ -420,9 +420,9 @@ int32_t bitcoin_verifyvins(void *ctx,char *symbol,uint8_t taddr,uint8_t pubtype,
}
if ( zcash == LP_IS_BITCOINCASH )
sighash |= SIGHASH_FORKID;
printf("bitcoin_verifyvins scriptlen.%d siglen.%d\n",scriptlen,V[vini].signers[0].siglen);
//printf("bitcoin_verifyvins scriptlen.%d siglen.%d\n",scriptlen,V[vini].signers[0].siglen);
sigtxid = bitcoin_sigtxid(taddr,pubtype,p2shtype,isPoS,height,serialized,maxlen,msgtx,vini,script,scriptlen,sighash,vpnstr,suppress_pubkeys,zcash);
printf("bitcoin_verifyvins scriptlen.%d siglen.%d\n",scriptlen,V[vini].signers[0].siglen);
//printf("bitcoin_verifyvins scriptlen.%d siglen.%d\n",scriptlen,V[vini].signers[0].siglen);
if ( bits256_nonz(sigtxid) != 0 )
{
vp = &V[vini];
@ -462,14 +462,14 @@ int32_t bitcoin_verifyvins(void *ctx,char *symbol,uint8_t taddr,uint8_t pubtype,
{
flag++;
numsigs++;
int32_t z; char tmpaddr[64];
/*int32_t z; char tmpaddr[64];
for (z=0; z<siglen-1; z++)
printf("%02x",sig[z]);
printf(" <- sig[%d]\n",j);
for (z=0; z<33; z++)
printf("%02x",vp->signers[j].pubkey[z]);
bitcoin_address(tmpaddr,0,0,vp->signers[j].pubkey,33);
printf(" <- pub, SIG.%d.%d VERIFIED numsigs.%d vs M.%d %s\n",vini,j,numsigs,vp->M,tmpaddr);
printf(" <- pub, SIG.%d.%d VERIFIED numsigs.%d vs M.%d %s\n",vini,j,numsigs,vp->M,tmpaddr);*/
}
}
if ( numsigs >= vp->M )

Loading…
Cancel
Save