jl777 8 years ago
parent
commit
e744704e3b
  1. 7
      basilisk/basilisk_swap.c
  2. 14
      iguana/iguana_sign.c
  3. 2
      iguana/tests/decoderawtransaction

7
basilisk/basilisk_swap.c

@ -393,6 +393,7 @@ int32_t basilisk_verify_bobpaid(struct supernet_info *myinfo,void *ptr,uint8_t *
int32_t basilisk_alicepayment_spend(struct supernet_info *myinfo,struct basilisk_swap *swap,struct basilisk_rawtx *dest)
{
printf("alicepayment_spend\n");
swap->alicepayment.spendlen = basilisk_alicescript(swap->alicepayment.redeemscript,&swap->alicepayment.redeemlen,swap->alicepayment.spendscript,0,swap->alicepayment.destaddr,swap->alicecoin->chain->p2shtype,swap->pubAm,swap->pubBn);
return(basilisk_rawtx_sign(myinfo,swap->alicecoin->blocks.hwmchain.height,swap,dest,&swap->alicepayment,swap->privAm,&swap->privBn,0,0));
}
@ -509,8 +510,8 @@ uint32_t basilisk_swaprecv(struct supernet_info *myinfo,uint8_t *verifybuf,int32
}
free_json(retarray);
if ( (crc= basilisk_majority32(datalenp,rawcrcs,datalens,numcrcs)) != 0 )
printf("majority crc.%08x\n",crc);
else printf("no majority from rawcrcs.%d\n",numcrcs);
printf("have majority crc.%08x\n",crc);
//else printf("no majority from rawcrcs.%d\n",numcrcs);
}
return(crc);
}
@ -897,7 +898,7 @@ struct basilisk_swap *bitcoin_swapinit(struct supernet_info *myinfo,struct basil
basilisk_rawtx_setparms("alicepayment",myinfo,swap,&swap->alicepayment,swap->alicecoin,swap->aliceconfirms,0,swap->alicesatoshis,2,0);
basilisk_rawtx_setparms("bobspend",myinfo,swap,&swap->bobspend,swap->alicecoin,swap->aliceconfirms,2,swap->alicesatoshis-swap->alicecoin->txfee,1,bobpub33);
swap->bobspend.suppress_pubkeys = 1;
swap->bobspend.suppress_pubkeys = 0;
basilisk_rawtx_setparms("alicereclaim",myinfo,swap,&swap->alicereclaim,swap->alicecoin,swap->aliceconfirms,2,swap->alicesatoshis-swap->alicecoin->txfee,1,alicepub33);
swap->alicereclaim.suppress_pubkeys = 1;
return(swap);

14
iguana/iguana_sign.c

@ -53,7 +53,7 @@ int32_t iguana_vinparse(struct iguana_info *coin,int32_t rwflag,uint8_t *seriali
printf("iguana_vinparse illegal scriptlen.%d\n",msg->scriptlen);
return(-1);
}
printf("len.%d scriptlen.%d user.%d p2sh.%d\n",len,msg->scriptlen,msg->userdatalen,msg->p2shlen);
//printf("len.%d scriptlen.%d user.%d p2sh.%d\n",len,msg->scriptlen,msg->userdatalen,msg->p2shlen);
if ( rwflag == 0 )
{
msg->vinscript = &serialized[len];
@ -88,7 +88,7 @@ int32_t iguana_vinparse(struct iguana_info *coin,int32_t rwflag,uint8_t *seriali
memcpy(&serialized[len],msg->redeemscript,p2shlen), len += p2shlen;
}
}
printf("sequence starts.%d\n",len);
//printf("sequence starts.%d\n",len);
len += iguana_rwnum(rwflag,&serialized[len],sizeof(msg->sequence),&msg->sequence);
if ( 0 )
{
@ -250,7 +250,7 @@ int32_t iguana_parsevinobj(struct supernet_info *myinfo,struct iguana_info *coin
starti = len;
len += iguana_rwvarint32(rwflag,&serialized[len],&tmp);
endi = len;
printf("rwflag.%d len.%d tmp.%d\n",rwflag,len,tmp);
//printf("rwflag.%d len.%d tmp.%d\n",rwflag,len,tmp);
if ( need_op0 != 0 )
serialized[len++] = 0; // hack for bug for bug backward compatibility
if ( hexstr != 0 )
@ -336,7 +336,7 @@ int32_t iguana_parsevinobj(struct supernet_info *myinfo,struct iguana_info *coin
serialized[starti] = tmp;
for (i=starti+1; i<starti+1+tmp; i++)
serialized[i] = serialized[i+2];
printf("tmp.%d (len.%d - starti.%d) i.%d\n",tmp,len,starti,i);
//printf("tmp.%d (len.%d - starti.%d) i.%d\n",tmp,len,starti,i);
len -= 2;
}
/*else if ( tmp < 0x10000 )
@ -355,7 +355,7 @@ int32_t iguana_parsevinobj(struct supernet_info *myinfo,struct iguana_info *coin
serialized[starti+1] = (tmp & 0xff);
serialized[starti+2] = ((tmp >> 8) & 0xff);
}
printf("len.%d tmp.%d output sequence.[%d] <- %x\n",len,tmp,len,vin->sequence);
//printf("len.%d tmp.%d output sequence.[%d] <- %x\n",len,tmp,len,vin->sequence);
len += iguana_rwnum(rwflag,&serialized[len],sizeof(vin->sequence),&vin->sequence);
if ( 0 && spendstr != 0 )
{
@ -516,7 +516,7 @@ int32_t iguana_rwmsgtx(struct iguana_info *coin,int32_t height,int32_t rwflag,cJ
}
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 ( vins != 0 && (vin= jitem(vins,i)) != 0 )
{
if ( (redeemstr= jstr(vin,"redeemScript")) != 0 && is_hexstr(redeemstr,0) > 0 )
@ -524,7 +524,7 @@ int32_t iguana_rwmsgtx(struct iguana_info *coin,int32_t height,int32_t rwflag,cJ
}
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 )
{

2
iguana/tests/decoderawtransaction

@ -1 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTC\",\"method\":\"decoderawtransaction\",\"params\":[\"0100000001f215835662ed81fee4ac662135b70c8273ecdd9242b1e02397c0835c67c397fc00000000fc6a514c676304ae9ee557b1752102a9669e63ef1ab04913615c2f3887ea3584f81e5f08feee9535b19ab3739d8afdac67a914adfad35d6646a0514011ba6ab53462319b651f96882103225046c9947222ab04acdefe2ed5dec4dcb593c5e6ae58e2c61c7ace14d81b70ac680000000001ca8c0000000000001976a914b7128d2ee837cf03e30a2c0e3e0181f7b9669bb688acae9ee557\", 1]}"
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"decoderawtransaction\",\"params\":[\"010000006dace557013155fe9a842de866684908683863c1142c2949f455d1a6353984ae06a9aac5a400000000904730440220356242c03f0245137e34cb113861da6c3c4c2c56adb8e215f9f822a078558743022035679f0b44b9d2472270eec78ffa7452addff29146a31801003661a940aa817701473044022048bd70d9e1b3cf57b0fee2e67e15666f1498aef5d114280b13f7ac8c0df7c96c022036b7a6528ed36e342e456d77e62a0a95edffa91f9321f11d5b95ed20c7f8fe6d01ffffffff01706f9800000000001976a9148ee61a3161993f4f7b7081259bf5f3322d65d3f888ac00000000\", 1]}"

Loading…
Cancel
Save