jl777 8 years ago
parent
commit
ac272f5355
  1. 1
      basilisk/basilisk.h
  2. 7
      basilisk/basilisk_swap.c
  3. 15
      iguana/iguana_sign.c
  4. 2
      iguana/tests/decoderawtransactionB

1
basilisk/basilisk.h

@ -47,6 +47,7 @@ struct basilisk_rawtx
bits256 txid,signedtxid,actualtxid;
struct iguana_msgtx msgtx;
struct iguana_info *coin;
cJSON *vins;
uint64_t amount,change,inputsum;
int32_t redeemlen,datalen,completed,vintype,vouttype,numconfirms,spendlen,secretstart,suppress_pubkeys;
uint32_t locktime,crcs[2];

7
basilisk/basilisk_swap.c

@ -1295,6 +1295,7 @@ void basilisk_swaploop(void *_swap)
{
retval = 0;
printf("GENERATED BOB DEPOSIT\n");
iguana_unspents_mark(myinfo,swap->bobcoin,swap->bobdeposit.vins);
break;
}
}
@ -1313,6 +1314,7 @@ void basilisk_swaploop(void *_swap)
{
retval = 0;
printf("GENERATED BOB PAYMENT\n");
iguana_unspents_mark(myinfo,swap->bobcoin,swap->bobpayment.vins);
break;
}
}
@ -1336,12 +1338,17 @@ void basilisk_swaploop(void *_swap)
else
{
retval = 0;
printf("ALICE PAYMENT created\n");
iguana_unspents_mark(myinfo,swap->alicecoin,swap->alicepayment.vins);
break;
}
}
}
if ( basilisk_rawtx_gen("myfee",myinfo,swap->iambob,1,&swap->myfee,0,swap->myfee.spendscript,swap->myfee.spendlen,swap->myfee.coin->chain->txfee,1) == 0 )
{
swap->statebits |= basilisk_swapdata_rawtxsend(myinfo,swap,0x80,data,maxlen,&swap->myfee,0x40);
iguana_unspents_mark(myinfo,swap->iambob!=0?swap->bobcoin:swap->alicecoin,swap->myfee.vins);
}
else
{
printf("error creating myfee\n");

15
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];
@ -93,7 +93,7 @@ int32_t iguana_vinparse(struct iguana_info *coin,int32_t rwflag,uint8_t *seriali
}
}
}
printf("sequence starts.%d %08x\n",len,*(int32_t *)&serialized[len]);
//printf("sequence starts.%d %08x\n",len,*(int32_t *)&serialized[len]);
len += iguana_rwnum(rwflag,&serialized[len],sizeof(msg->sequence),&msg->sequence);
if ( 0 )
{
@ -363,7 +363,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
@ -374,7 +374,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 ( spendstr != 0 )
{
@ -577,14 +577,14 @@ 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 && jitem(vins,i) != 0 )
iguana_vinobjset(&msg->vins[i],jitem(vins,i),spendscript,sizeof(spendscript));
if ( (n= iguana_vinparse(coin,rwflag,&serialized[len],&msg->vins[i])) < 0 )
return(-1);
if ( msg->vins[i].spendscript == spendscript )
msg->vins[i].spendscript = 0;
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 )
{
@ -592,9 +592,6 @@ int32_t iguana_rwmsgtx(struct iguana_info *coin,int32_t height,int32_t rwflag,cJ
return(-1);
}
}
for (i=0; i<4; i++)
printf("%02x",serialized[len+i]);
printf(" len.%d\n",len);
len += iguana_rwvarint32(rwflag,&serialized[len],&msg->tx_out);
if ( rwflag == 0 )
{

2
iguana/tests/decoderawtransactionB

@ -1 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"decoderawtransaction\",\"params\":[\"0100000060f3e757010c373fe408334a1d01d9676525e67e72fde44589200803f98255ac198774a1d800000000d8473044022042a560e1ee15661f0e4b7a72a0fbccdf023979e624b75339c4e49aaf892b85cb02205aa8191c2ee2670b7ac0896c97f3dfb8525f692d9e644dc392f45995d44727a001483045022100de5f3d59f01bbea508b979d302ca3e0168128f5cd6603ba8f2dd326648f6e117022030d70b7dc5d6238394da505c56a8da0eaa7355b27daf618548c3f27c16eb6f290147522102991c77e5194b03dda2ef2a4d49059b58c721021c92d810fc78094005b22c989e21032e90296e9678bb3157febeeb9e5912b1ebda33e6561b7beaa896096bfcec60dc52aeffffffff01706f9800000000001976a9148ee61a3161993f4f7b7081259bf5f3322d65d3f888ac00000000\"]}"
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"decoderawtransaction\",\"params\":[\"0100000021fde75701151b564fe4e5c316b331838b13600795ac981e99b950d80054c498f5ac5abf7f00000000da483045022100b038ff111f90bb62bfc59ea431c843fb60f54cab13e76cb204b4934c995f06370220466fa43979589e4cf5e9a784f3781a1f7947c14251a385305b79cf2ef86887f801483045022100e7731a9398b82c234a52538943caeaeffc8183b6ec4a42f9fe20b9cc3ba6981902200e285a7a6b3963016900c7dfbfdbc6635bdf9cdae642c9419649a70f8462f214014752210272532a1ce14bc3ee2049584b15e429fac230311f94bb43dd90b69ed3f395ec8d2103868005f78f7cafbf639257ad4173800748053a83418f0f5f472ca5b8efcb637a52aeffffffff01706f9800000000001976a9148ee61a3161993f4f7b7081259bf5f3322d65d3f888ac00000000\"]}"

Loading…
Cancel
Save