|
|
@ -93,7 +93,7 @@ void basilisk_dontforget(struct basilisk_swap *swap,struct basilisk_rawtx *rawtx |
|
|
|
sprintf(fname,"%s/SWAPS/%u-%u",GLOBAL_DBDIR,swap->I.req.requestid,swap->I.req.quoteid), OS_compatible_path(fname); |
|
|
|
if ( (fp= fopen(fname,"wb")) != 0 ) |
|
|
|
{ |
|
|
|
fprintf(fp,"{\"src\":\"%s\",\"srcamount\":%.8f,\"dest\":\"%s\",\"destamount\":%.8f,\"requestid\":%u,\"quoteid\":%u,\"iambob\":%d,\"state\":%u,\"otherstate\":%u,\"expiration\":%u,\"dlocktime\":%u,\"plocktime\":%u,\"Atxfee\":%llu,\"Btxfee\":%llu",swap->I.req.src,dstr(swap->I.req.srcamount),swap->I.req.dest,dstr(swap->I.req.destamount),swap->I.req.requestid,swap->I.req.quoteid,swap->I.iambob,swap->I.statebits,swap->I.otherstatebits,swap->I.expiration,swap->bobdeposit.I.locktime,swap->bobpayment.I.locktime,(long long)swap->I.Atxfee,(long long)swap->I.Btxfee); |
|
|
|
fprintf(fp,"{\"aliceid\":\"%llu\",\"src\":\"%s\",\"srcamount\":%.8f,\"dest\":\"%s\",\"destamount\":%.8f,\"requestid\":%u,\"quoteid\":%u,\"iambob\":%d,\"state\":%u,\"otherstate\":%u,\"expiration\":%u,\"dlocktime\":%u,\"plocktime\":%u,\"Atxfee\":%llu,\"Btxfee\":%llu",(long long)swap->aliceid,swap->I.req.src,dstr(swap->I.req.srcamount),swap->I.req.dest,dstr(swap->I.req.destamount),swap->I.req.requestid,swap->I.req.quoteid,swap->I.iambob,swap->I.statebits,swap->I.otherstatebits,swap->I.expiration,swap->bobdeposit.I.locktime,swap->bobpayment.I.locktime,(long long)swap->I.Atxfee,(long long)swap->I.Btxfee); |
|
|
|
if ( memcmp(zeroes,swap->I.secretAm,20) != 0 ) |
|
|
|
{ |
|
|
|
init_hexbytes_noT(secretAmstr,swap->I.secretAm,20); |
|
|
@ -463,7 +463,8 @@ void LP_totals_update(int32_t iambob,char *alicecoin,char *bobcoin,int64_t *KMDt |
|
|
|
struct LP_swap_remember |
|
|
|
{ |
|
|
|
bits256 pubA0,pubB0,pubB1,privAm,privBn,paymentspent,Apaymentspent,depositspent,myprivs[2],txids[sizeof(txnames)/sizeof(*txnames)]; |
|
|
|
uint64_t Atxfee,Btxfee,srcamount,destamount; int64_t values[sizeof(txnames)/sizeof(*txnames)]; |
|
|
|
uint64_t Atxfee,Btxfee,srcamount,destamount,aliceid; |
|
|
|
int64_t values[sizeof(txnames)/sizeof(*txnames)]; |
|
|
|
uint32_t requestid,quoteid,plocktime,dlocktime,expiration,state,otherstate; |
|
|
|
int32_t iambob,finishedflag,origfinishedflag,Predeemlen,Dredeemlen,sentflags[sizeof(txnames)/sizeof(*txnames)]; |
|
|
|
uint8_t secretAm[20],secretAm256[32],secretBn[20],secretBn256[32],Predeemscript[1024],Dredeemscript[1024],pubkey33[33],other33[33]; |
|
|
@ -483,6 +484,7 @@ cJSON *LP_swap_json(struct LP_swap_remember *rswap) |
|
|
|
jaddstr(item,"alice",rswap->dest); |
|
|
|
jaddnum(item,"destamount",dstr(rswap->destamount)); |
|
|
|
jaddnum(item,"alicetxfee",dstr(rswap->Atxfee)); |
|
|
|
jadd64bits(item,"aliceid",rswap->aliceid); |
|
|
|
array = cJSON_CreateArray(); |
|
|
|
for (i=0; i<sizeof(txnames)/sizeof(*txnames); i++) |
|
|
|
{ |
|
|
@ -521,6 +523,7 @@ int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t |
|
|
|
if ( (item= cJSON_Parse(fstr)) != 0 ) |
|
|
|
{ |
|
|
|
rswap->iambob = jint(item,"iambob"); |
|
|
|
rswap->aliceid = j64bits(item,"aliceid"); |
|
|
|
if ( (secretstr= jstr(item,"secretAm")) != 0 && strlen(secretstr) == 40 ) |
|
|
|
decode_hex(rswap->secretAm,20,secretstr); |
|
|
|
if ( (secretstr= jstr(item,"secretAm256")) != 0 && strlen(secretstr) == 64 ) |
|
|
|