jl777 8 years ago
parent
commit
eae15c72ce
  1. 30
      basilisk/basilisk_swap.c
  2. 4
      iguana/iguana_sign.c
  3. 2
      iguana/tests/decoderawtransactionB

30
basilisk/basilisk_swap.c

@ -748,7 +748,7 @@ int32_t basilisk_rawtx_gen(char *str,struct supernet_info *myinfo,int32_t iambob
jaddnum(valsobj,"timeout",30000);
rawtx->locktime = locktime;
printf("%s locktime.%u\n",rawtx->name,locktime);
V = calloc(16,sizeof(*V));
V = calloc(256,sizeof(*V));
if ( (retstr= basilisk_bitcoinrawtx(myinfo,rawtx->coin,"",basilisktag,jint(valsobj,"timeout"),valsobj,V)) != 0 )
{
printf("%s %s basilisk_bitcoinrawtx.(%s)\n",rawtx->name,str,retstr);
@ -1285,11 +1285,25 @@ void basilisk_swaploop(void *_swap)
for (i=0; i<3; i++)
{
basilisk_rawtx_gen("deposit",myinfo,1,1,&swap->bobdeposit,swap->bobdeposit.locktime,swap->bobdeposit.spendscript,swap->bobdeposit.spendlen,swap->bobdeposit.coin->chain->txfee,1);
if ( swap->bobdeposit.txbytes == 0 || swap->bobdeposit.spendlen == 0 )
{
printf("error bob generating %p deposit.%d\n",swap->bobdeposit.txbytes,swap->bobdeposit.spendlen);
retval = -2;
sleep(3);
}
else
{
retval = 0;
break;
}
for (i=0; i<3; i++)
{
basilisk_rawtx_gen("payment",myinfo,1,1,&swap->bobpayment,swap->bobpayment.locktime,swap->bobpayment.spendscript,swap->bobpayment.spendlen,swap->bobpayment.coin->chain->txfee,1);
if ( swap->bobdeposit.txbytes == 0 || swap->bobdeposit.spendlen == 0 || swap->bobpayment.txbytes == 0 || swap->bobpayment.spendlen == 0 )
if ( swap->bobpayment.txbytes == 0 || swap->bobpayment.spendlen == 0 )
{
printf("error bob generating %p deposit.%d or %p payment.%d\n",swap->bobdeposit.txbytes,swap->bobdeposit.spendlen,swap->bobpayment.txbytes,swap->bobpayment.spendlen);
printf("error bob generating %p payment.%d\n",swap->bobpayment.txbytes,swap->bobpayment.spendlen);
retval = -2;
sleep(3);
}
else
{
@ -1297,6 +1311,7 @@ void basilisk_swaploop(void *_swap)
break;
}
}
}
/*if ( basilisk_bobpayment_reclaim(myinfo,swap) < 0 || basilisk_bobdeposit_refund(myinfo,swap) < 0 )
{
printf("error bob reclaiming\n");
@ -1304,12 +1319,21 @@ void basilisk_swaploop(void *_swap)
}*/
}
else
{
for (i=0; i<3; i++)
{
basilisk_alicepayment(myinfo,swap->alicepayment.coin,&swap->alicepayment,swap->pubAm,swap->pubBn);
if ( swap->alicepayment.txbytes == 0 || swap->alicepayment.spendlen == 0 )
{
printf("error alice generating payment.%d\n",swap->alicepayment.spendlen);
retval = -4;
sleep(3);
}
else
{
retval = 0;
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 )

4
iguana/iguana_sign.c

@ -26,14 +26,14 @@ int32_t iguana_vinparse(struct iguana_info *coin,int32_t rwflag,uint8_t *seriali
if ( rwflag == 1 )
{
tmp = msg->scriptlen + msg->userdatalen + msg->p2shlen;
/*if ( msg->p2shlen != 0 )
if ( msg->p2shlen != 0 )
{
if ( msg->p2shlen < 76 )
tmp++;
else if ( msg->p2shlen < 0x100 )
tmp += 2;
else tmp += 3;
}*/
}
}
len += iguana_rwvarint32(rwflag,&serialized[len],&tmp);
if ( rwflag == 0 )

2
iguana/tests/decoderawtransactionB

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

Loading…
Cancel
Save