|
@ -244,7 +244,7 @@ bits256 basilisk_swap_privBn_extract(bits256 *bobrefundp,char *bobcoin,bits256 b |
|
|
return(privBn); |
|
|
return(privBn); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bits256 basilisk_swap_spendupdate(char *symbol,char *spentaddr,int32_t *sentflags,bits256 *txids,int32_t utxoind,int32_t alicespent,int32_t bobspent,int32_t vout,char *aliceaddr,char *bobaddr) |
|
|
bits256 basilisk_swap_spendupdate(char *symbol,char *spentaddr,int32_t *sentflags,bits256 *txids,int32_t utxoind,int32_t alicespent,int32_t bobspent,int32_t vout,char *aliceaddr,char *bobaddr,char *Adest,char *dest) |
|
|
{ |
|
|
{ |
|
|
bits256 spendtxid,txid; char destaddr[64],str[65]; struct iguana_info *coin; cJSON *histobj; |
|
|
bits256 spendtxid,txid; char destaddr[64],str[65]; struct iguana_info *coin; cJSON *histobj; |
|
|
if ( (coin= LP_coinfind(symbol)) != 0 && coin->electrum != 0 ) |
|
|
if ( (coin= LP_coinfind(symbol)) != 0 && coin->electrum != 0 ) |
|
@ -265,14 +265,14 @@ bits256 basilisk_swap_spendupdate(char *symbol,char *spentaddr,int32_t *sentflag |
|
|
{ |
|
|
{ |
|
|
sentflags[utxoind] = 1; |
|
|
sentflags[utxoind] = 1; |
|
|
printf("utxoind.%d Alice.(%s) Bob.(%s)\n",utxoind,aliceaddr,bobaddr); |
|
|
printf("utxoind.%d Alice.(%s) Bob.(%s)\n",utxoind,aliceaddr,bobaddr); |
|
|
if ( aliceaddr != 0 && strcmp(destaddr,aliceaddr) == 0 ) |
|
|
if ( aliceaddr != 0 && (strcmp(destaddr,aliceaddr) == 0 || strcmp(Adest,destaddr) == 0) ) |
|
|
{ |
|
|
{ |
|
|
printf("ALICE spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); |
|
|
printf("ALICE spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); |
|
|
sentflags[alicespent] = 1; |
|
|
sentflags[alicespent] = 1; |
|
|
sentflags[bobspent] = 0; |
|
|
sentflags[bobspent] = 0; |
|
|
txids[alicespent] = spendtxid; |
|
|
txids[alicespent] = spendtxid; |
|
|
} |
|
|
} |
|
|
else if ( bobaddr != 0 && strcmp(destaddr,bobaddr) == 0 ) |
|
|
else if ( bobaddr != 0 && (strcmp(destaddr,bobaddr) == 0 || strcmp(dest,destaddr) == 0) ) |
|
|
{ |
|
|
{ |
|
|
printf("BOB spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); |
|
|
printf("BOB spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); |
|
|
sentflags[bobspent] = 1; |
|
|
sentflags[bobspent] = 1; |
|
@ -284,13 +284,13 @@ bits256 basilisk_swap_spendupdate(char *symbol,char *spentaddr,int32_t *sentflag |
|
|
printf("OTHER dest spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); |
|
|
printf("OTHER dest spent.(%s) -> %s\n",bits256_str(str,txid),destaddr); |
|
|
if ( aliceaddr != 0 ) |
|
|
if ( aliceaddr != 0 ) |
|
|
{ |
|
|
{ |
|
|
sentflags[bobspent] = 1; |
|
|
sentflags[bobspent] = 0; |
|
|
sentflags[alicespent] = 0; |
|
|
sentflags[alicespent] = 0; |
|
|
txids[bobspent] = spendtxid; |
|
|
txids[bobspent] = spendtxid; |
|
|
} |
|
|
} |
|
|
else if ( bobaddr != 0 ) |
|
|
else if ( bobaddr != 0 ) |
|
|
{ |
|
|
{ |
|
|
sentflags[alicespent] = 1; |
|
|
sentflags[alicespent] = 0; |
|
|
sentflags[bobspent] = 0; |
|
|
sentflags[bobspent] = 0; |
|
|
txids[alicespent] = spendtxid; |
|
|
txids[alicespent] = spendtxid; |
|
|
} |
|
|
} |
|
@ -840,8 +840,8 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti |
|
|
printf("Bob.%p is null or Alice.%p is null\n",bob,alice); |
|
|
printf("Bob.%p is null or Alice.%p is null\n",bob,alice); |
|
|
return(cJSON_Parse("{\"error\":\"null bob or alice coin\"}")); |
|
|
return(cJSON_Parse("{\"error\":\"null bob or alice coin\"}")); |
|
|
} |
|
|
} |
|
|
printf("ALICE 1st refht %s <- %d, scan %d %d\n",alice->symbol,alice->firstrefht,alice->firstscanht,alice->lastscanht); |
|
|
printf("ALICE.(%s) 1st refht %s <- %d, scan %d %d\n",rswap.Adestaddr,alice->symbol,alice->firstrefht,alice->firstscanht,alice->lastscanht); |
|
|
printf("BOB 1st refht %s <- %d, scan %d %d\n",bob->symbol,bob->firstrefht,bob->firstscanht,bob->lastscanht); |
|
|
printf("BOB.(%s) 1st refht %s <- %d, scan %d %d\n",rswap.destaddr,bob->symbol,bob->firstrefht,bob->firstscanht,bob->lastscanht); |
|
|
//printf("iambob.%d finishedflag.%d %s %.8f txfee, %s %.8f txfee\n",rswap.iambob,rswap.finishedflag,rswap.alicecoin,dstr(rswap.Atxfee),rswap.bobcoin,dstr(rswap.Btxfee));
|
|
|
//printf("iambob.%d finishedflag.%d %s %.8f txfee, %s %.8f txfee\n",rswap.iambob,rswap.finishedflag,rswap.alicecoin,dstr(rswap.Atxfee),rswap.bobcoin,dstr(rswap.Btxfee));
|
|
|
//printf("privAm.(%s) %p/%p\n",bits256_str(str,rswap.privAm),Adest,AAdest);
|
|
|
//printf("privAm.(%s) %p/%p\n",bits256_str(str,rswap.privAm),Adest,AAdest);
|
|
|
//printf("privBn.(%s) %p/%p\n",bits256_str(str,rswap.privBn),Bdest,ABdest);
|
|
|
//printf("privBn.(%s) %p/%p\n",bits256_str(str,rswap.privBn),Bdest,ABdest);
|
|
@ -855,9 +855,9 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti |
|
|
LP_rswap_checktx(&rswap,rswap.alicecoin,BASILISK_ALICEPAYMENT); |
|
|
LP_rswap_checktx(&rswap,rswap.alicecoin,BASILISK_ALICEPAYMENT); |
|
|
LP_rswap_checktx(&rswap,rswap.bobcoin,BASILISK_BOBPAYMENT); |
|
|
LP_rswap_checktx(&rswap,rswap.bobcoin,BASILISK_BOBPAYMENT); |
|
|
LP_rswap_checktx(&rswap,rswap.bobcoin,BASILISK_BOBDEPOSIT); |
|
|
LP_rswap_checktx(&rswap,rswap.bobcoin,BASILISK_BOBDEPOSIT); |
|
|
rswap.paymentspent = basilisk_swap_spendupdate(rswap.bobcoin,rswap.bobpaymentaddr,rswap.sentflags,rswap.txids,BASILISK_BOBPAYMENT,BASILISK_ALICESPEND,BASILISK_BOBRECLAIM,0,Adest,Bdest); |
|
|
rswap.paymentspent = basilisk_swap_spendupdate(rswap.bobcoin,rswap.bobpaymentaddr,rswap.sentflags,rswap.txids,BASILISK_BOBPAYMENT,BASILISK_ALICESPEND,BASILISK_BOBRECLAIM,0,Adest,Bdest,rswap.Adestaddr,rswap.destaddr); |
|
|
rswap.Apaymentspent = basilisk_swap_spendupdate(rswap.alicecoin,rswap.alicepaymentaddr,rswap.sentflags,rswap.txids,BASILISK_ALICEPAYMENT,BASILISK_ALICERECLAIM,BASILISK_BOBSPEND,0,AAdest,ABdest); |
|
|
rswap.Apaymentspent = basilisk_swap_spendupdate(rswap.alicecoin,rswap.alicepaymentaddr,rswap.sentflags,rswap.txids,BASILISK_ALICEPAYMENT,BASILISK_ALICERECLAIM,BASILISK_BOBSPEND,0,AAdest,ABdest,rswap.Adestaddr,rswap.destaddr); |
|
|
rswap.depositspent = basilisk_swap_spendupdate(rswap.bobcoin,rswap.bobdepositaddr,rswap.sentflags,rswap.txids,BASILISK_BOBDEPOSIT,BASILISK_ALICECLAIM,BASILISK_BOBREFUND,0,Adest,Bdest); |
|
|
rswap.depositspent = basilisk_swap_spendupdate(rswap.bobcoin,rswap.bobdepositaddr,rswap.sentflags,rswap.txids,BASILISK_BOBDEPOSIT,BASILISK_ALICECLAIM,BASILISK_BOBREFUND,0,Adest,Bdest,rswap.Adestaddr,rswap.destaddr); |
|
|
rswap.finishedflag = basilisk_swap_isfinished(rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent); |
|
|
rswap.finishedflag = basilisk_swap_isfinished(rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent); |
|
|
if ( rswap.iambob == 0 ) |
|
|
if ( rswap.iambob == 0 ) |
|
|
{ |
|
|
{ |
|
|