Browse Source

Test

etomic
jl777 8 years ago
parent
commit
e8d4b07426
  1. 12
      iguana/exchanges/LP_swap.c
  2. 3
      iguana/exchanges/LP_transaction.c
  3. 2
      iguana/exchanges/LP_utxos.c

12
iguana/exchanges/LP_swap.c

@ -406,13 +406,13 @@ int32_t LP_waitfor(int32_t pairsock,struct basilisk_swap *swap,int32_t timeout,i
void *data; int32_t datalen,retval = -1; uint32_t expiration = (uint32_t)time(NULL) + timeout;
while ( time(NULL) < expiration )
{
printf("start wait\n");
//printf("start wait\n");
if ( (datalen= nn_recv(pairsock,&data,NN_MSG,0)) >= 0 )
{
printf("wait for got.%d\n",datalen);
//printf("wait for got.%d\n",datalen);
retval = (*verify)(swap,data,datalen);
nn_freemsg(data);
printf("retval.%d\n",retval);
//printf("retval.%d\n",retval);
return(retval);
} else printf("error nn_recv\n");
}
@ -423,15 +423,15 @@ int32_t LP_waitfor(int32_t pairsock,struct basilisk_swap *swap,int32_t timeout,i
int32_t LP_waitsend(char *statename,int32_t timeout,int32_t pairsock,struct basilisk_swap *swap,uint8_t *data,int32_t maxlen,int32_t (*verify)(struct basilisk_swap *swap,uint8_t *data,int32_t datalen),int32_t (*datagen)(struct basilisk_swap *swap,uint8_t *data,int32_t maxlen))
{
int32_t datalen,sendlen,retval = -1;
printf("waitsend.%s\n",statename);
//printf("waitsend.%s\n",statename);
if ( LP_waitfor(pairsock,swap,timeout,verify) == 0 )
{
printf("waited for %s\n",statename);
//printf("waited for %s\n",statename);
if ( (datalen= (*datagen)(swap,data,maxlen)) > 0 )
{
if ( (sendlen= nn_send(pairsock,data,datalen,0)) == datalen )
{
printf("sent.%d after waitfor.%s\n",sendlen,statename);
//printf("sent.%d after waitfor.%s\n",sendlen,statename);
retval = 0;
} else printf("send %s error\n",statename);
} else printf("%s datagen no data\n",statename);

3
iguana/exchanges/LP_transaction.c

@ -1501,8 +1501,7 @@ int32_t basilisk_alicetxs(int32_t pairsock,struct basilisk_swap *swap,uint8_t *d
{
bitcoin_address(swap->alicepayment.I.destaddr,swap->alicecoin.p2shtype,swap->alicepayment.redeemscript,swap->alicepayment.I.redeemlen);
//LP_importaddress(swap->alicecoin.symbol,swap->alicepayment.I.destaddr);
if ( strcmp(swap->alicepayment.I.destaddr,swap->alicepayment.p2shaddr) != 0 )
printf("alice addr mismatch %s vs %s\n",swap->alicepayment.I.destaddr,swap->alicepayment.p2shaddr);
strcpy(swap->alicepayment.p2shaddr,swap->alicepayment.I.destaddr);
retval = 0;
for (i=0; i<swap->alicepayment.I.datalen; i++)
printf("%02x",swap->alicepayment.txbytes[i]);

2
iguana/exchanges/LP_utxos.c

@ -448,7 +448,7 @@ struct LP_utxoinfo *LP_utxoadd(int32_t iambob,int32_t mypubsock,char *symbol,bit
}
LP_utxosetkey(utxo->key,txid,vout);
LP_utxosetkey(utxo->key2,txid2,vout2);
char str[65],str2[65],str3[65]; printf("%s iambob.%d %s %s utxoadd.(%.8f %.8f) %s %s\n",utxo->coinaddr,iambob,bits256_str(str3,utxo->pubkey),utxo->coin,dstr(value),dstr(value2),bits256_str(str,utxo->payment.txid),bits256_str(str2,txid2));
//char str[65],str2[65],str3[65]; printf("%s iambob.%d %s %s utxoadd.(%.8f %.8f) %s %s\n",utxo->coinaddr,iambob,bits256_str(str3,utxo->pubkey),utxo->coin,dstr(value),dstr(value2),bits256_str(str,utxo->payment.txid),bits256_str(str2,txid2));
portable_mutex_lock(&LP_utxomutex);
HASH_ADD_KEYPTR(hh,LP_utxoinfos[iambob],utxo->key,sizeof(utxo->key),utxo);
if ( _LP_utxo2find(iambob,txid2,vout2) == 0 )

Loading…
Cancel
Save