Browse Source

test

etomic
jl777 8 years ago
parent
commit
66d1c509d9
  1. 10
      basilisk/basilisk_swap.c
  2. 6
      iguana/iguana_payments.c
  3. 4
      iguana/iguana_unspents.c

10
basilisk/basilisk_swap.c

@ -658,7 +658,7 @@ int32_t basilisk_rawtx_return(struct supernet_info *myinfo,int32_t height,struct
{
if ( lockinputs != 0 )
{
printf("lockinputs\n");
//printf("lockinputs\n");
iguana_RTunspentslock(myinfo,rawtx->coin,vins);
if ( (n= cJSON_GetArraySize(vins)) != 0 )
{
@ -786,7 +786,7 @@ int32_t basilisk_bobscripts_set(struct supernet_info *myinfo,struct basilisk_swa
else
{
swap->bobdeposit.I.spendlen = basilisk_bobscript(swap->bobdeposit.I.rmd160,swap->bobdeposit.redeemscript,&swap->bobdeposit.I.redeemlen,swap->bobdeposit.spendscript,0,&swap->bobdeposit.I.locktime,&swap->bobdeposit.I.secretstart,&swap->I,1);
if ( genflag != 0 )
if ( genflag != 0 && (swap->bobdeposit.txbytes == 0 || swap->bobrefund.txbytes == 0) )
{
for (i=0; i<3; i++)
{
@ -813,6 +813,7 @@ int32_t basilisk_bobscripts_set(struct supernet_info *myinfo,struct basilisk_swa
return(0);
}
}
return(0);
}
//for (i=0; i<swap->bobdeposit.redeemlen; i++)
// printf("%02x",swap->bobdeposit.redeemscript[i]);
@ -1813,6 +1814,7 @@ void basilisk_swaploop(void *_swap)
if ( basilisk_bobscripts_set(myinfo,swap,1,1) < 0 )
{
sleep(3);
printf("bobscripts set error\n");
continue;
}
}
@ -1840,14 +1842,16 @@ void basilisk_swaploop(void *_swap)
}
}
}
printf("generate fee\n");
if ( basilisk_rawtx_gen("myfee",myinfo,swap,swap->I.iambob,1,&swap->myfee,0,swap->myfee.spendscript,swap->myfee.I.spendlen,swap->myfee.coin->chain->txfee,1,0) == 0 )
{
printf("done generate fee\n");
swap->I.statebits |= basilisk_swapdata_rawtxsend(myinfo,swap,0x80,data,maxlen,&swap->myfee,0x40);
iguana_unspents_mark(myinfo,swap->I.iambob!=0?swap->bobcoin:swap->alicecoin,swap->myfee.vins);
basilisk_txlog(myinfo,swap,&swap->myfee,-1);
for (i=0; i<swap->myfee.I.spendlen; i++)
printf("%02x",swap->myfee.txbytes[i]);
printf(" alice fee %p %x\n",swap->myfee.txbytes,swap->I.statebits);
printf(" fee %p %x\n",swap->myfee.txbytes,swap->I.statebits);
swap->I.statebits |= 0x40;
if ( swap->alicepayment.txbytes != 0 && swap->alicepayment.I.spendlen > 0 )
break;

6
iguana/iguana_payments.c

@ -170,7 +170,7 @@ int32_t iguana_RTbestunspent(struct supernet_info *myinfo,struct iguana_info *co
{
if ( (atx_value= unspents[i].value) <= 0 )
{
printf("illegal value.%d\n",i);
//printf("illegal value.%d\n",i);
continue;
}
if ( iguana_RTunspent_check(myinfo,coin,unspents[i]) != 0 )
@ -217,7 +217,7 @@ int32_t iguana_RTbestunspent(struct supernet_info *myinfo,struct iguana_info *co
*abovep = above;
*belowip = belowi;
*belowp = below;
printf("above.%d below.%d\n",abovei,belowi);
//printf("above.%d below.%d\n",abovei,belowi);
return(abovei >= 0 ? abovei : belowi);
}
@ -418,7 +418,7 @@ char *iguana_calcrawtx(struct supernet_info *myinfo,struct iguana_info *coin,cJS
coinaddr = jstri(addresses,i);
if ( (array= basilisk_unspents(myinfo,coin,coinaddr)) != 0 )
{
printf("unspents.(%s) %s\n",coinaddr,jprint(array,0));
//printf("unspents.(%s) %s\n",coinaddr,jprint(array,0));
if ( (m= cJSON_GetArraySize(array)) > 0 )
{
for (j=0; j<m; j++)

4
iguana/iguana_unspents.c

@ -133,7 +133,7 @@ char *iguana_RTinputaddress(struct supernet_info *myinfo,struct iguana_info *coi
if ( coinaddr == 0 )
coinaddr = _coinaddr;
spentp->hdrsi = -1;
printf("%s RTinputaddress.(%s).%d %d\n",coin->symbol,jprint(vinobj,0),coin->FULLNODE,coin->notarychain);
//printf("%s RTinputaddress.(%s).%d %d\n",coin->symbol,jprint(vinobj,0),coin->FULLNODE,coin->notarychain);
if ( jobj(vinobj,"txid") != 0 && jobj(vinobj,"vout") != 0 )
{
txid = jbits256(vinobj,"txid");
@ -142,7 +142,7 @@ char *iguana_RTinputaddress(struct supernet_info *myinfo,struct iguana_info *coi
{
if ( (retstr= _dex_gettxout(myinfo,coin->symbol,txid,vout)) != 0 )
{
printf("dexgetO.(%s)\n",retstr);
//printf("dexgetO.(%s)\n",retstr);
if ( (txoutjson= cJSON_Parse(retstr)) != 0 )
{
if ( (array= jarray(&n,txoutjson,"addresses")) != 0 )

Loading…
Cancel
Save