|
|
@ -395,7 +395,7 @@ int32_t basilisk_isbobcoin(int32_t iambob,int32_t ind) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int32_t basilisk_swap_isfinished(uint32_t expiration,int32_t iambob,bits256 *txids,int32_t *sentflags,bits256 paymentspent,bits256 Apaymentspent,bits256 depositspent) |
|
|
|
int32_t basilisk_swap_isfinished(uint32_t requestid,uint32_t quoteid,uint32_t expiration,int32_t iambob,bits256 *txids,int32_t *sentflags,bits256 paymentspent,bits256 Apaymentspent,bits256 depositspent) |
|
|
|
{ |
|
|
|
int32_t i,n = 0; uint32_t now = (uint32_t)time(NULL); |
|
|
|
if ( bits256_nonz(paymentspent) != 0 && bits256_nonz(Apaymentspent) != 0 && bits256_nonz(depositspent) != 0 ) |
|
|
@ -404,7 +404,7 @@ int32_t basilisk_swap_isfinished(uint32_t expiration,int32_t iambob,bits256 *txi |
|
|
|
{ |
|
|
|
if ( sentflags[BASILISK_ALICECLAIM] != 0 ) |
|
|
|
{ |
|
|
|
printf("edge case unspendable alicepayment\n"); |
|
|
|
printf("edge case unspendable alicepayment %u-%u\n",requestid,quoteid); |
|
|
|
return(1); |
|
|
|
} |
|
|
|
else if ( iambob != 0 && sentflags[BASILISK_ALICECLAIM] != 0 ) |
|
|
@ -447,7 +447,7 @@ int32_t basilisk_swap_isfinished(uint32_t expiration,int32_t iambob,bits256 *txi |
|
|
|
if ( bits256_nonz(depositspent) != 0 ) |
|
|
|
{ |
|
|
|
if ( bits256_nonz(Apaymentspent) == 0 && sentflags[BASILISK_BOBREFUND] == 0 ) |
|
|
|
printf("bob was too late in claiming bobrefund\n"); |
|
|
|
printf("bob was too late in claiming bobrefund %u-%u\n",requestid,quoteid); |
|
|
|
return(1); |
|
|
|
} |
|
|
|
} |
|
|
@ -756,7 +756,7 @@ int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t |
|
|
|
} |
|
|
|
free_json(txobj); |
|
|
|
} |
|
|
|
rswap->origfinishedflag = basilisk_swap_isfinished(rswap->expiration,rswap->iambob,rswap->txids,rswap->sentflags,rswap->paymentspent,rswap->Apaymentspent,rswap->depositspent); |
|
|
|
rswap->origfinishedflag = basilisk_swap_isfinished(requestid,quoteid,rswap->expiration,rswap->iambob,rswap->txids,rswap->sentflags,rswap->paymentspent,rswap->Apaymentspent,rswap->depositspent); |
|
|
|
rswap->finishedflag = rswap->origfinishedflag; |
|
|
|
if ( forceflag != 0 ) |
|
|
|
rswap->finishedflag = rswap->origfinishedflag = 0; |
|
|
@ -1115,7 +1115,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti |
|
|
|
rswap.paymentspent = basilisk_swap_spendupdate(rswap.iambob,rswap.bobcoin,rswap.bobpaymentaddr,rswap.sentflags,rswap.txids,BASILISK_BOBPAYMENT,BASILISK_ALICESPEND,BASILISK_BOBRECLAIM,0,srcAdest,srcBdest,rswap.Adestaddr,rswap.destaddr); |
|
|
|
rswap.Apaymentspent = basilisk_swap_spendupdate(rswap.iambob,rswap.alicecoin,rswap.alicepaymentaddr,rswap.sentflags,rswap.txids,BASILISK_ALICEPAYMENT,BASILISK_ALICERECLAIM,BASILISK_BOBSPEND,0,destAdest,destBdest,rswap.Adestaddr,rswap.destaddr); |
|
|
|
rswap.depositspent = basilisk_swap_spendupdate(rswap.iambob,rswap.bobcoin,rswap.bobdepositaddr,rswap.sentflags,rswap.txids,BASILISK_BOBDEPOSIT,BASILISK_ALICECLAIM,BASILISK_BOBREFUND,0,srcAdest,srcBdest,rswap.Adestaddr,rswap.destaddr); |
|
|
|
rswap.finishedflag = basilisk_swap_isfinished(rswap.expiration,rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent); |
|
|
|
rswap.finishedflag = basilisk_swap_isfinished(requestid,quoteid,rswap.expiration,rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent); |
|
|
|
LP_spends_set(&rswap); |
|
|
|
if ( rswap.iambob == 0 ) |
|
|
|
{ |
|
|
@ -1322,7 +1322,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti |
|
|
|
LP_totals_update(rswap.iambob,rswap.alicecoin,rswap.bobcoin,KMDtotals,BTCtotals,rswap.sentflags,rswap.values); |
|
|
|
if ( (numspent= LP_spends_set(&rswap)) == 3 ) |
|
|
|
rswap.finishedflag = 1; |
|
|
|
else rswap.finishedflag = basilisk_swap_isfinished(rswap.expiration,rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent); |
|
|
|
else rswap.finishedflag = basilisk_swap_isfinished(requestid,quoteid,rswap.expiration,rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent); |
|
|
|
if ( rswap.origfinishedflag == 0 && rswap.finishedflag != 0 ) |
|
|
|
{ |
|
|
|
char fname[1024],*itemstr; FILE *fp; |
|
|
|