Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
183f83cf7e
  1. 12
      basilisk/basilisk_swap.c
  2. 16
      iguana/iguana_sign.c

12
basilisk/basilisk_swap.c

@ -233,18 +233,6 @@ int32_t basilisk_rawtx_sign(struct supernet_info *myinfo,int32_t height,struct b
jaddi(vins,item);
jdelete(txobj,"vin");
jadd(txobj,"vin",vins);
//010000000141f18ce3a5c90069a04ade56f3277dbaa2d141f8ff708543455d9d620be512ee00000000
//8b
//20fe936da3707c8c4cc7eb0352160ec3f50b9454d46425df6347b2fbc5b2ec87ea00
//4c676304165daa57b1752102a9669e63ef1ab04913615c2f3887ea3584f81e5f08feee9535b19ab3739d8afdac67a9143805600256ed8498ca1ec426759212e5835e8dc2882103a7b696908f77d69ec89887f8c4a0423b9e80b5974dc43301bd7d8abad07e1211ac68ffffffff013d55
//0000000000001976a9143ef4734c1141725c095342095f6e0e7748b6c16588ac00000000
//
//
// 010000000141f18ce3a5c90069a04ade56f3277dbaa2d141f8ff708543455d9d620be512ee00000000
//d147304402206b65cdd65f646bcc8ed3011e1d6bdb78d615c0f96f00b204d8561599ef77860c02202c5fca26317cc42ea037c1925530ac0e9ad22beda63717617da84107f833f30901
//20fe936da3707c8c4cc7eb0352160ec3f50b9454d46425df6347b2fbc5b2ec87ea00
//4c676304165daa57b1752102a9669e63ef1ab04913615c2f3887ea3584f81e5f08feee9535b19ab3739d8afdac67a9143805600256ed8498ca1ec426759212e5835e8dc2882103a7b696908f77d69ec89887f8c4a0423b9e80b5974dc43301bd7d8abad07e1211ac68ffffffff013d55
//0000000000001976a9143ef4734c1141725c095342095f6e0e7748b6c16588ac00000000
printf("basilisk_rawtx_sign locktime.%u/%u for %s spendscript.%s -> %s, suppress.%d\n",rawtx->locktime,dest->locktime,rawtx->name,hexstr,dest->name,dest->suppress_pubkeys);
txobj = bitcoin_txoutput(txobj,dest->spendscript,dest->spendlen,dest->amount);
if ( (rawtxbytes= bitcoin_json2hex(myinfo,rawtx->coin,&dest->txid,txobj,&V)) != 0 )

16
iguana/iguana_sign.c

@ -89,7 +89,7 @@ int32_t iguana_vinparse(struct iguana_info *coin,int32_t rwflag,uint8_t *seriali
}
}
len += iguana_rwnum(rwflag,&serialized[len],sizeof(msg->sequence),&msg->sequence);
if ( 1 )
if ( 0 )
{
int32_t i; char str[65];
for (i=0; i<len; i++)
@ -171,7 +171,7 @@ int32_t iguana_parsehexstr(uint8_t **destp,uint16_t *lenp,uint8_t *dest2,int32_t
int32_t iguana_parsevinobj(struct supernet_info *myinfo,struct iguana_info *coin,uint8_t *serialized,int32_t maxsize,struct iguana_msgvin *vin,cJSON *vinobj,struct vin_info *V)
{
struct iguana_waddress *waddr; struct iguana_waccount *wacct; uint32_t tmp=0; int32_t i,n,starti,suppress_pubkeys,siglen,plen,m,rwflag=1,need_op0=0,len = 0; char *userdata,*pubkeystr,*hexstr = 0,*redeemstr = 0,*spendstr = 0; cJSON *scriptjson = 0,*obj,*pubkeysjson = 0;
struct iguana_waddress *waddr; struct iguana_waccount *wacct; uint8_t lastbyte; uint32_t tmp=0; int32_t i,n,starti,suppress_pubkeys,siglen,plen,m,rwflag=1,need_op0=0,len = 0; char *userdata,*pubkeystr,*hexstr = 0,*redeemstr = 0,*spendstr = 0; cJSON *scriptjson = 0,*obj,*pubkeysjson = 0;
//printf("PARSEVIN.(%s) vin.%p\n",jprint(vinobj,0),vin);
if ( V == 0 )
memset(vin,0,sizeof(*vin));
@ -189,12 +189,22 @@ int32_t iguana_parsevinobj(struct supernet_info *myinfo,struct iguana_info *coin
if ( ((spendstr= jstr(vinobj,"scriptPub")) == 0 && (spendstr= jstr(vinobj,"scriptPubkey")) == 0) || is_hexstr(spendstr,(int32_t)strlen(spendstr)) <= 0 )
{
if ( (obj= jobj(vinobj,"scriptPub")) != 0 || (obj= jobj(vinobj,"scriptPubkey")) != 0 )
{
spendstr = jstr(obj,"hex");
lastbyte = _decode_hex(&spendstr[strlen(spendstr)-2]);
if ( lastbyte == SCRIPT_OP_CHECKMULTISIG )
need_op0 = 1;
}
}
if ( (redeemstr= jstr(vinobj,"redeemScript")) == 0 || is_hexstr(redeemstr,(int32_t)strlen(redeemstr)) <= 0 )
{
if ( (obj= jobj(vinobj,"redeemScript")) != 0 )
{
redeemstr = jstr(obj,"hex");
lastbyte = _decode_hex(&redeemstr[strlen(redeemstr)-2]);
if ( lastbyte == SCRIPT_OP_CHECKMULTISIG )
need_op0 = 1;
}
}
if ( (userdata= jstr(vinobj,"userdata")) == 0 || is_hexstr(userdata,(int32_t)strlen(userdata)) <= 0 )
{
@ -236,6 +246,8 @@ int32_t iguana_parsevinobj(struct supernet_info *myinfo,struct iguana_info *coin
while ( m < n )
{
siglen = serialized[len + m++];
if ( i == 0 && m == 1 && siglen == 0 ) // multisig backward compatible
continue;
memcpy(V->signers[i].sig,&serialized[len + m],siglen);
m += siglen;
i++;

Loading…
Cancel
Save