Browse Source

Test

etomic
jl777 7 years ago
parent
commit
ac6a388aba
  1. 6
      iguana/exchanges/LP_include.h
  2. 19
      iguana/exchanges/LP_swap.c

6
iguana/exchanges/LP_include.h

@ -180,12 +180,12 @@ struct vin_info
uint8_t rmd160[20],spendscript[10000],p2shscript[10000],userdata[10000];
};
struct basilisk_swapmessage
/*struct basilisk_swapmessage
{
bits256 srchash,desthash;
uint32_t crc32,msgbits,quoteid,datalen;
uint8_t *data;
};
};*/
struct basilisk_swap;
@ -383,7 +383,7 @@ struct basilisk_swap
struct basilisk_swapinfo I;
struct basilisk_rawtx bobdeposit,bobpayment,alicepayment,myfee,otherfee,aliceclaim,alicespend,bobreclaim,bobspend,bobrefund,alicereclaim;
bits256 privkeys[INSTANTDEX_DECKSIZE];
struct basilisk_swapmessage *messages; int32_t nummessages,sentflag;
//struct basilisk_swapmessage *messages; int32_t nummessages,sentflag;
char Bdeposit[64],Bpayment[64];
uint64_t aliceid,otherdeck[INSTANTDEX_DECKSIZE][2],deck[INSTANTDEX_DECKSIZE][2];
uint8_t persistent_pubkey33[33],persistent_other33[33],changermd160[20],pad[15],verifybuf[100000];

19
iguana/exchanges/LP_swap.c

@ -126,8 +126,8 @@ void basilisk_rawtx_purge(struct basilisk_rawtx *rawtx)
void basilisk_swap_finished(struct basilisk_swap *swap)
{
int32_t i;
/*if ( swap->utxo != 0 && swap->sentflag == 0 )
/*int32_t i;
if ( swap->utxo != 0 && swap->sentflag == 0 )
{
LP_availableset(swap->utxo);
swap->utxo = 0;
@ -159,11 +159,11 @@ void basilisk_swap_finished(struct basilisk_swap *swap)
basilisk_rawtx_purge(&swap->bobspend);
basilisk_rawtx_purge(&swap->bobrefund);
basilisk_rawtx_purge(&swap->alicereclaim);
for (i=0; i<swap->nummessages; i++)
/*for (i=0; i<swap->nummessages; i++)
if ( swap->messages[i].data != 0 )
free(swap->messages[i].data), swap->messages[i].data = 0;
free(swap->messages), swap->messages = 0;
swap->nummessages = 0;
swap->nummessages = 0;*/
if ( swap->N.pair >= 0 )
nn_close(swap->N.pair), swap->N.pair = -1;
}
@ -837,7 +837,7 @@ void LP_bobloop(void *_swap)
printf("error sending bobpayment\n");
//if ( LP_waitfor(swap->N.pair,swap,10,LP_verify_alicespend) < 0 )
// printf("error waiting for alicespend\n");
swap->sentflag = 1;
//swap->sentflag = 1;
swap->bobreclaim.utxovout = 0;
swap->bobreclaim.utxotxid = swap->bobpayment.I.signedtxid;
basilisk_bobpayment_reclaim(swap,swap->I.callduration);
@ -873,7 +873,7 @@ void LP_aliceloop(void *_swap)
printf("error LP_sendwait mostprivs\n");
else if ( basilisk_alicetxs(swap->N.pair,swap,data,maxlen) != 0 )
printf("basilisk_alicetxs error\n");
else
else if ( 0 )
{
LP_swapsfp_update(&swap->I.req);
LP_swap_critical = (uint32_t)time(NULL);
@ -905,7 +905,7 @@ void LP_aliceloop(void *_swap)
char str[65];printf("%d wait for alicepayment %s numconfs.%d %s %s\n",n,swap->alicepayment.I.destaddr,m,swap->I.alicestr,bits256_str(str,swap->alicepayment.I.signedtxid));
sleep(10);
}
swap->sentflag = 1;
//swap->sentflag = 1;
LP_swap_critical = (uint32_t)time(NULL);
if ( LP_waitfor(swap->N.pair,swap,1800,LP_verify_bobpayment) < 0 )
printf("error waiting for bobpayment\n");
@ -934,11 +934,6 @@ void LP_aliceloop(void *_swap)
}
}
free(data);
if ( swap->N.pair >= 0 )
{
nn_close(swap->N.pair);
swap->N.pair = -1;
}
basilisk_swap_finished(swap);
printf("finish swap.%p\n",swap);
free(swap);

Loading…
Cancel
Save