Browse Source

Test

etomic
jl777 8 years ago
parent
commit
b3131f816d
  1. 2
      .gitignore
  2. 46
      basilisk/basilisk_swap.c
  3. 2
      basilisk/jumblr.c

2
.gitignore

@ -234,3 +234,5 @@ iguana/DB/SWAPS/1061498231-3266306388
iguana/DB/SWAPS/1060082251-3390546616
iguana/SVM/rawfeatures/BTCD_BTC
iguana/DB/SWAPS/1032184933-1028220623

46
basilisk/basilisk_swap.c

@ -1948,12 +1948,14 @@ void basilisk_sendmostprivs(struct supernet_info *myinfo,struct basilisk_swap *s
int32_t basilisk_swapiteration(struct supernet_info *myinfo,struct basilisk_swap *swap,uint8_t *data,int32_t maxlen)
{
int32_t j,datalen,retval = 0;
if ( swap->I.iambob != 0 )
swap->I.statebits |= 0x80;
while ( ((swap->I.otherstatebits & 0x80) == 0 || (swap->I.statebits & 0x80) == 0) && retval == 0 && time(NULL) < swap->I.expiration )
{
if ( swap->connected == 0 )
basilisk_psockinit(myinfo,swap,swap->I.iambob != 0);
printf("D r%u/q%u swapstate.%x otherstate.%x\n",swap->I.req.requestid,swap->I.req.quoteid,swap->I.statebits,swap->I.otherstatebits);
if ( (swap->I.statebits & 0x80) == 0 ) // wait for fee
printf("D r%u/q%u swapstate.%x otherstate.%x remaining %d\n",swap->I.req.requestid,swap->I.req.quoteid,swap->I.statebits,swap->I.otherstatebits,(int32_t)(swap->I.expiration-time(NULL)));
if ( swap->I.iambob != 0 && (swap->I.statebits & 0x80) == 0 ) // wait for fee
{
if ( basilisk_swapget(myinfo,swap,0x80,data,maxlen,basilisk_verify_otherfee) == 0 )
{
@ -2384,25 +2386,25 @@ void basilisk_swaploop(void *_swap)
break;
}
}
}
printf("generate fee\n");
if ( basilisk_rawtx_gen("myfee",myinfo,swap->I.started,swap->persistent_pubkey33,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,0);
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(" fee %p %x\n",swap->myfee.txbytes,swap->I.statebits);
swap->I.statebits |= 0x40;
if ( swap->alicepayment.I.datalen != 0 && swap->alicepayment.I.spendlen > 0 )
break;
}
else
{
printf("error creating myfee\n");
retval = -6;
printf("generate fee\n");
if ( basilisk_rawtx_gen("myfee",myinfo,swap->I.started,swap->persistent_pubkey33,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,0);
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(" fee %p %x\n",swap->myfee.txbytes,swap->I.statebits);
swap->I.statebits |= 0x40;
if ( swap->alicepayment.I.datalen != 0 && swap->alicepayment.I.spendlen > 0 )
break;
}
else
{
printf("error creating myfee\n");
retval = -6;
}
}
}
}
@ -2418,7 +2420,7 @@ void basilisk_swaploop(void *_swap)
printf("ALICE's error %d %d %d\n",swap->myfee.I.datalen,swap->alicepayment.I.datalen,swap->alicepayment.I.datalen);
retval = -7;
}
else if ( swap->I.iambob != 0 && (swap->myfee.I.datalen == 0 || swap->bobdeposit.I.datalen == 0) ) //swap->bobpayment.I.datalen == 0
else if ( swap->I.iambob != 0 && swap->bobdeposit.I.datalen == 0 ) //swap->bobpayment.I.datalen == 0
{
printf("BOB's error %d %d %d\n",swap->myfee.I.datalen,swap->bobpayment.I.datalen,swap->bobdeposit.I.datalen);
retval = -7;

2
basilisk/jumblr.c

@ -652,7 +652,7 @@ void jumblr_utxoupdate(struct supernet_info *myinfo,char *dest,struct iguana_inf
void jumblr_DEXupdate(struct supernet_info *myinfo,struct iguana_info *coin,char *symbol,char *CMCname,double BTC2KMD,double KMDavail)
{
double avebid,aveask,highbid,lowask,CMC_average,changes[3],estfee,estbtcfee; struct iguana_info *btccoin,*kmdcoin; struct DEXcoin_info *ptr = &coin->DEXinfo;
double avebid,aveask,highbid,lowask,CMC_average,changes[3],estfee,estbtcfee; struct iguana_info *kmdcoin; struct DEXcoin_info *ptr = &coin->DEXinfo;
// wait for one confirmation to clear most in mempool (ha, ha)
// deal with changing addresses, ie all pendings?
estfee = 0.0001;

Loading…
Cancel
Save