Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
89c182fd9f
  1. 2
      basilisk/basilisk_swap.c
  2. 28
      iguana/iguana_sign.c
  3. 2
      iguana/tests/d

2
basilisk/basilisk_swap.c

@ -238,7 +238,7 @@ int32_t basilisk_rawtx_sign(struct supernet_info *myinfo,struct basilisk_swap *s
txobj = bitcoin_txoutput(txobj,dest->spendscript,dest->spendlen,dest->amount);
if ( (rawtxbytes= bitcoin_json2hex(myinfo,rawtx->coin,&dest->txid,txobj,&V)) != 0 )
{
printf("(%s) spend rawtx.(%s) userdatalen.%d p2shlen.%d\n",jprint(txobj,0),rawtxbytes,userdatalen,dest->redeemlen);
printf("(%s) spend.%s rawtx.(%s) userdatalen.%d p2shlen.%d\n",jprint(txobj,0),rawtx->name,rawtxbytes,userdatalen,dest->redeemlen);
if ( (signedtx= iguana_signrawtx(myinfo,rawtx->coin,&dest->signedtxid,&dest->completed,vins,rawtxbytes,privkeys,&V)) != 0 )
{
printf("rawtx spend signedtx.(%s)\n",signedtx);

28
iguana/iguana_sign.c

@ -129,7 +129,7 @@ int32_t iguana_parsehexstr(uint8_t **destp,uint16_t *lenp,uint8_t *dest2,int32_t
{
int32_t n;
n = (int32_t)strlen(hexstr) >> 1;
printf("addhex.(%s) %d\n",hexstr,n);
//printf("addhex.(%s) %d\n",hexstr,n);
if ( serialized == 0 )
serialized = *destp;
if ( serialized != 0 )
@ -222,7 +222,7 @@ int32_t iguana_parsevinobj(struct supernet_info *myinfo,struct iguana_info *coin
if ( hexstr != 0 )
{
n = (int32_t)strlen(hexstr) >> 1;
printf("add.(%s) offset.%d\n",hexstr,len);
//printf("add.(%s) offset.%d\n",hexstr,len);
decode_hex(serialized,n,hexstr);
vin->vinscript = serialized;
vin->scriptlen = n;
@ -272,13 +272,13 @@ int32_t iguana_parsevinobj(struct supernet_info *myinfo,struct iguana_info *coin
}
}
}
printf("len.%d: ",len);
//printf("len.%d: ",len);
if ( userdata != 0 )
{
n = iguana_parsehexstr(&vin->userdata,&vin->userdatalen,V!=0?V->userdata:0,V!=0?&V->userdatalen:0,serialized,userdata);
len += n, serialized += n;
}
printf("len.%d: ",len);
//printf("len.%d: ",len);
if ( redeemstr != 0 )
{
n = (int32_t)strlen(redeemstr) >> 1;
@ -301,12 +301,12 @@ int32_t iguana_parsevinobj(struct supernet_info *myinfo,struct iguana_info *coin
n = iguana_parsehexstr(&vin->redeemscript,&vin->p2shlen,V!=0?V->p2shscript:0,V!=0?&V->p2shlen:0,serialized,redeemstr);
len += n, serialized += n;
}
printf("len.%d: ",len);
//printf("len.%d: ",len);
if ( spendstr != 0 )
{
n = iguana_parsehexstr(&vin->spendscript,&vin->spendlen,V!=0?V->spendscript:0,V!=0?&V->spendlen:0,0,spendstr);
}
printf("output sequence.[%d] <- %x\n",len,vin->sequence);
//printf("output sequence.[%d] <- %x\n",len,vin->sequence);
len += iguana_rwnum(rwflag,&serialized[len],sizeof(vin->sequence),&vin->sequence);
return(len);
}
@ -457,10 +457,10 @@ int32_t iguana_rwmsgtx(struct iguana_info *coin,int32_t rwflag,cJSON *json,uint8
}
for (i=0; i<msg->tx_in; i++)
{
printf("vin.%d starts offset.%d\n",i,len);
//printf("vin.%d starts offset.%d\n",i,len);
if ( (n= iguana_vinparse(coin,rwflag,&serialized[len],&msg->vins[i])) < 0 )
return(-1);
printf("vin.%d n.%d len.%d\n",i,n,len);
//printf("vin.%d n.%d len.%d\n",i,n,len);
len += n;
if ( len > maxsize )
{
@ -505,7 +505,7 @@ int32_t iguana_rwmsgtx(struct iguana_info *coin,int32_t rwflag,cJSON *json,uint8
}
for (i=0; i<msg->tx_out; i++)
{
printf("vout.%d starts %d\n",i,len);
//printf("vout.%d starts %d\n",i,len);
if ( (n= iguana_voutparse(rwflag,&serialized[len],&msg->vouts[i])) < 0 )
return(-1);
len += n;
@ -586,7 +586,7 @@ bits256 iguana_parsetxobj(struct supernet_info *myinfo,struct iguana_info *coin,
{
for (i=0; i<msg->tx_in; i++)
{
printf("vinobj.%d starts offset.%d\n",i,len);
//printf("vinobj.%d starts offset.%d\n",i,len);
len += iguana_parsevinobj(myinfo,coin,&serialized[len],maxsize,&msg->vins[i],jitem(array,i),V!=0?&V[i]:0);
}
}
@ -614,9 +614,9 @@ bits256 iguana_parsetxobj(struct supernet_info *myinfo,struct iguana_info *coin,
*txstartp = 0;
msg->allocsize = len;
msg->txid = txid = bits256_doublesha256(0,serialized,len);
for (i=0; i<len; i++)
printf("%02x",serialized[i]);
printf(" parsetxobj len.%d\n",len);
//for (i=0; i<len; i++)
// printf("%02x",serialized[i]);
//printf(" parsetxobj len.%d\n",len);
/*if ( (len= iguana_rwmsgtx(coin,1,0,&serialized[len],maxsize-len,msg,&txid,vpnstr,0,0,0,V!=0?V->suppress_pubkeys:0)) != msg->allocsize )
{
//memset(txid.bytes,0,sizeof(txid));
@ -1194,7 +1194,7 @@ int32_t iguana_signrawtransaction(struct supernet_info *myinfo,struct iguana_inf
{
printf("txobj.(%s)\n",jprint(txobj,0));
}
if ( 1 && (checkstr= bitcoin_json2hex(myinfo,coin,&txid,txobj,V)) != 0 )
if ( juint(txobj,"suppress") == 0 && (checkstr= bitcoin_json2hex(myinfo,coin,&txid,txobj,V)) != 0 )
{
if ( strcmp(rawtx,checkstr) != 0 )
{

2
iguana/tests/d

@ -1 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTC\",\"method\":\"decoderawtransaction\",\"params\":[\"0100000001093b08a007d4413bf45d515ea8099a3b015578b6d7b4f2cb19b54f5f3120132c00000000f6483045022100fa96a98d128fd59fdbf236445766324d17676e19e235dee7e00a35ed3a5c44d4022039dae3cab9f507a22a6a474323e14b8272d27d0d3f32b3015b2e2ea21a222a3d0120ae439d344513eab8e718d8214fe6ae8133b8b5b594afd64da21d0e40b9c37cdd004c6763041686a657b1752102a9669e63ef1ab04913615c2f3887ea3584f81e5f08feee9535b19ab3739d8afdac67a914ed74c61c27656abc6c20687c3a9212ffdc6f34cd88210398a4cb9f6ea7c52a4e27455028a95e2e4e397a110fb75f072c2c58a8bdcbf4baac6820ae439d344513eab8e718d8214fe6ae8133b8b5b594afd64da21d0e40b9c37cdd00ffffffff0000000000\", 1]}"
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"decoderawtransaction\",\"params\":[\"010000009049a757019cb804dc1c70059d45c8d135bd630b2be9fcd27dd6c9d5510aec0d25e43f734b01000000834730440220777a24cf3b508571eeb597c3c8055dbf84e5a2bd17ff574a6fab7b258c10a37902200241979f977098b6691572642251bdc8f5737ec2fe7c20e95871774fb0e675200121020ce8ffc263769bfa15579b2757873ea5690107acfafb6dc1b77cd7057ac3834900000000000000000000000000000000000000000000000000ffffffff028096980000000000475221021193f3676d50b15b51a386af7a93bac569a8a71536cb3f41775cc1906771e97121032991f9c5088fca3d839c1971889c2f671d98551af2386c89628ea49f7c0b0df552ae00947604000000001976a91421e112f4211cbc612bc5f3de86acf0017b88b67d88ac00000000\", 0]}"

Loading…
Cancel
Save