Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
39127e8515
  1. 5
      iguana/iguana777.c
  2. 20
      iguana/iguana_payments.c
  3. 4
      iguana/swaps/iguana_BTCswap.c

5
iguana/iguana777.c

@ -144,7 +144,8 @@ double iguana_metric(struct iguana_peer *addr,uint32_t now,double decay)
int32_t iguana_inv2poll(struct supernet_info *myinfo,struct iguana_info *coin) int32_t iguana_inv2poll(struct supernet_info *myinfo,struct iguana_info *coin)
{ {
struct exchange_info *exchange; int32_t i,n=0; struct iguana_peer *addr; struct exchange_info *exchange; int32_t i,n=0; struct iguana_peer *addr; char myipaddr[64];
expand_ipbits(myipaddr,myinfo->myaddr.myipbits);
//printf("iguana_inv2poll exchange.%p %s maxpeers.%d\n",exchanges777_find("bitcoin"),coin->symbol,coin->MAXPEERS); //printf("iguana_inv2poll exchange.%p %s maxpeers.%d\n",exchanges777_find("bitcoin"),coin->symbol,coin->MAXPEERS);
if ( coin != 0 && (exchange= exchanges777_find("bitcoin")) != 0 && strcmp(coin->symbol,"BTCD") == 0 ) if ( coin != 0 && (exchange= exchanges777_find("bitcoin")) != 0 && strcmp(coin->symbol,"BTCD") == 0 )
{ {
@ -157,7 +158,7 @@ int32_t iguana_inv2poll(struct supernet_info *myinfo,struct iguana_info *coin)
if ( addr->supernet != 0 ) if ( addr->supernet != 0 )
{ {
//printf("iguana_inv2poll (%s) usock.%d dead.%u ready.%u ipbits.%u supernet.%d\n",addr->ipaddr,addr->usock,addr->dead,addr->ready,(uint32_t)addr->ipbits,addr->supernet); //printf("iguana_inv2poll (%s) usock.%d dead.%u ready.%u ipbits.%u supernet.%d\n",addr->ipaddr,addr->usock,addr->dead,addr->ready,(uint32_t)addr->ipbits,addr->supernet);
if ( addr->usock >= 0 && addr->dead == 0 && addr->ready != 0 && addr->ipbits != 0 ) if ( addr->usock >= 0 && addr->dead == 0 && addr->ready != 0 && addr->ipbits != 0 && strcmp(addr->ipaddr,myipaddr) != 0 )
{ {
instantdex_inv2data(myinfo,coin,addr,exchange); instantdex_inv2data(myinfo,coin,addr,exchange);
n++; n++;

20
iguana/iguana_payments.c

@ -407,13 +407,15 @@ char *iguana_pollrawtx(queue_t *Q,cJSON **vinsp,uint32_t rawtxtag,double expirat
//printf("got RAWTX.(%s)\n",rawtx); //printf("got RAWTX.(%s)\n",rawtx);
if ( vinsp != 0 ) if ( vinsp != 0 )
*vinsp = ptr->vins; *vinsp = ptr->vins;
else free_json(ptr->vins); else if ( ptr->vins != 0 )
free_json(ptr->vins);
free(ptr); free(ptr);
return(rawtx); return(rawtx);
} }
else else
{ {
free_json(ptr->vins); if ( ptr->vins != 0 )
free_json(ptr->vins);
free(ptr); free(ptr);
} }
} }
@ -430,7 +432,8 @@ char *iguana_request_andwait(struct supernet_info *myinfo,queue_t *Q,cJSON **vin
reqstr = jprint(tmpjson,1); reqstr = jprint(tmpjson,1);
while ( (ptr= queue_dequeue(Q,0)) != 0 ) while ( (ptr= queue_dequeue(Q,0)) != 0 )
{ {
free_json(ptr->vins); if ( ptr->vins != 0 )
free_json(ptr->vins);
free(ptr); free(ptr);
} }
expiration = OS_milliseconds() + ((timeout == 0) ? 15000 : timeout); expiration = OS_milliseconds() + ((timeout == 0) ? 15000 : timeout);
@ -463,11 +466,14 @@ char *iguana_rawtxissue(struct supernet_info *myinfo,uint32_t rawtxtag,char *sym
spendlen = (int32_t)strlen(spendscriptstr) >> 1; spendlen = (int32_t)strlen(spendscriptstr) >> 1;
decode_hex(buf,spendlen,spendscriptstr); decode_hex(buf,spendlen,spendscriptstr);
bitcoin_txoutput(coin,txobj,buf,spendlen,satoshis); bitcoin_txoutput(coin,txobj,buf,spendlen,satoshis);
if ( (rawtx= iguana_calcrawtx(myinfo,coin,vinsp,txobj,satoshis,changeaddr,txfee,addresses,minconf)) != 0 && *vinsp != 0 ) if ( (rawtx= iguana_calcrawtx(myinfo,coin,vinsp,txobj,satoshis,changeaddr,txfee,addresses,minconf)) != 0 )
{ {
free_json(txobj); if ( *vinsp != 0 )
//printf("return rawtx.(%s) vins.%p\n",rawtx,*vinsp); {
return(rawtx); free_json(txobj);
//printf("return rawtx.(%s) vins.%p\n",rawtx,*vinsp);
return(rawtx);
} else free(rawtx);
} }
} }
} }

4
iguana/swaps/iguana_BTCswap.c

@ -1048,8 +1048,8 @@ char *instantdex_statemachine(struct instantdex_stateinfo *states,int32_t numsta
void instantdex_statemachine_iter(struct supernet_info *myinfo,struct exchange_info *exchange,struct bitcoin_swapinfo *swap) void instantdex_statemachine_iter(struct supernet_info *myinfo,struct exchange_info *exchange,struct bitcoin_swapinfo *swap)
{ {
char *str; struct bitcoin_eventitem *ptr; char *str; struct bitcoin_eventitem *ptr;
if ( instantdex_isbob(swap) != 0 && swap->myfee == 0 ) //if ( instantdex_isbob(swap) != 0 && swap->myfee == 0 )
swap->myfee = instantdex_feetx(myinfo,&swap->mine,swap,iguana_coinfind("BTC")); // swap->myfee = instantdex_feetx(myinfo,&swap->mine,swap,iguana_coinfind("BTC"));
while ( (ptr= queue_dequeue(&swap->eventsQ,0)) != 0 ) while ( (ptr= queue_dequeue(&swap->eventsQ,0)) != 0 )
{ {
printf("deQ arg.%p new.%p\n",ptr->argjson,ptr->newjson); printf("deQ arg.%p new.%p\n",ptr->argjson,ptr->newjson);

Loading…
Cancel
Save