|
|
@ -3229,11 +3229,12 @@ char *txnames[] = { "alicespend", "bobspend", "bobpayment", "alicepayment", "bob |
|
|
|
|
|
|
|
cJSON *basilisk_remember(struct supernet_info *myinfo,int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requestid,uint32_t quoteid) |
|
|
|
{ |
|
|
|
FILE *fp; struct iguana_info *coin; int32_t sentflags[sizeof(txnames)/sizeof(*txnames)],i,j,len,needflag,secretstart,redeemlen,addflag,finishedflag = 0,iambob = -1; int64_t srcamount,destamount=0,value,values[sizeof(txnames)/sizeof(*txnames)]; uint8_t secretAm[20],secretAm256[32],secretBn[20],secretBn256[32],pubkey33[33],redeemscript[512],userdata[512]; uint32_t plocktime,dlocktime,expiration=0,r,q,state,otherstate; char *secretstr,*srcstr,*deststr,str[65],src[64],dest[64],fname[512],*fstr,*dest33,*symbol,*Adest,*Bdest,*AAdest,*ABdest,destaddr[64],Adestaddr[64],alicecoin[64],bobcoin[64],*txbytes[sizeof(txnames)/sizeof(*txnames)]; long fsize; cJSON *txobj,*item,*sentobj,*array; bits256 checktxid,txid,pubA0,pubB0,pubB1,privAm,privBn,paymentspent,Apaymentspent,depositspent,zero,privkey,rev,myprivs[2],txids[sizeof(txnames)/sizeof(*txnames)]; |
|
|
|
FILE *fp; struct iguana_info *coin; int32_t sentflags[sizeof(txnames)/sizeof(*txnames)],i,j,len,needflag,secretstart,redeemlen,addflag,origfinishedflag = 0,finishedflag = 0,iambob = -1; int64_t srcamount,destamount=0,value,values[sizeof(txnames)/sizeof(*txnames)]; uint8_t secretAm[20],secretAm256[32],secretBn[20],secretBn256[32],pubkey33[33],redeemscript[512],userdata[512]; uint32_t plocktime,dlocktime,expiration=0,r,q,state,otherstate; char *secretstr,*srcstr,*deststr,str[65],src[64],dest[64],fname[512],*fstr,*dest33,*symbol,*Adest,*Bdest,*AAdest,*ABdest,destaddr[64],Adestaddr[64],alicecoin[64],bobcoin[64],*txbytes[sizeof(txnames)/sizeof(*txnames)]; long fsize; cJSON *txobj,*item,*sentobj,*array; bits256 checktxid,txid,pubA0,pubB0,pubB1,privAm,privBn,paymentspent,Apaymentspent,depositspent,zero,privkey,rev,myprivs[2],txids[sizeof(txnames)/sizeof(*txnames)]; |
|
|
|
sprintf(fname,"%s/SWAPS/%u-%u.finished",GLOBAL_DBDIR,requestid,quoteid), OS_compatible_path(fname); |
|
|
|
if ( (fp= fopen(fname,"rb")) != 0 ) |
|
|
|
{ |
|
|
|
finishedflag = 1; |
|
|
|
origfinishedflag = finishedflag = 1; |
|
|
|
fclose(fp); |
|
|
|
} |
|
|
|
memset(values,0,sizeof(values)); |
|
|
|
memset(txids,0,sizeof(txids)); |
|
|
@ -3663,11 +3664,13 @@ cJSON *basilisk_remember(struct supernet_info *myinfo,int64_t *KMDtotals,int64_t |
|
|
|
} |
|
|
|
jadd(item,"sentflags",array); |
|
|
|
jaddstr(item,"result","success"); |
|
|
|
jaddstr(item,"status","finished"); |
|
|
|
if ( finishedflag != 0 ) |
|
|
|
jaddstr(item,"status","finished"); |
|
|
|
else jaddstr(item,"status","pending"); |
|
|
|
bits256_str(str,paymentspent), jaddbits256(item,"paymentspent",paymentspent); |
|
|
|
bits256_str(str,Apaymentspent), jaddbits256(item,"Apaymentspent",Apaymentspent); |
|
|
|
bits256_str(str,depositspent), jaddbits256(item,"depositspent",depositspent); |
|
|
|
if ( finishedflag != 0 ) |
|
|
|
if ( origfinishedflag == 0 && finishedflag != 0 ) |
|
|
|
{ |
|
|
|
//printf("SWAP %u-%u finished!\n",requestid,quoteid);
|
|
|
|
sprintf(fname,"%s/SWAPS/%u-%u.finished",GLOBAL_DBDIR,requestid,quoteid), OS_compatible_path(fname); |
|
|
@ -3685,7 +3688,7 @@ cJSON *basilisk_remember(struct supernet_info *myinfo,int64_t *KMDtotals,int64_t |
|
|
|
|
|
|
|
char *basilisk_swaplist(struct supernet_info *myinfo) |
|
|
|
{ |
|
|
|
char fname[512]; FILE *fp; cJSON *item,*retjson,*array,*totalsobj; uint32_t quoteid,requestid; int64_t KMDtotals[16],BTCtotals[16],Btotal,Ktotal; int32_t i; |
|
|
|
char fname[512],*status; FILE *fp; cJSON *item,*retjson,*array,*totalsobj; uint32_t quoteid,requestid; int64_t KMDtotals[16],BTCtotals[16],Btotal,Ktotal; int32_t i; |
|
|
|
memset(KMDtotals,0,sizeof(KMDtotals)); |
|
|
|
memset(BTCtotals,0,sizeof(BTCtotals)); |
|
|
|
//,statebits; int32_t optionduration; struct basilisk_request R; bits256 privkey;
|
|
|
@ -3708,7 +3711,11 @@ char *basilisk_swaplist(struct supernet_info *myinfo) |
|
|
|
if ( flag == 0 ) |
|
|
|
{ |
|
|
|
if ( (item= basilisk_remember(myinfo,KMDtotals,BTCtotals,requestid,quoteid)) != 0 ) |
|
|
|
{ |
|
|
|
jaddi(array,item); |
|
|
|
if ( (status= jstr(item,"status")) != 0 && strcmp(status,"pending") == 0 ) |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
fclose(fp); |
|
|
|