jl777 7 years ago
parent
commit
73bba24806
  1. 1
      iguana/exchanges/LP_nativeDEX.c
  2. 16
      iguana/exchanges/LP_peers.c
  3. 10
      iguana/exchanges/LP_utxo.c

1
iguana/exchanges/LP_nativeDEX.c

@ -1150,6 +1150,7 @@ int32_t LP_reserved_msg(int32_t priority,char *base,char *rel,bits256 pubkey,cha
if ( (sentbytes= nn_send(pubp->pairsock,msg,(int32_t)strlen(msg)+1,0)) < 0 ) if ( (sentbytes= nn_send(pubp->pairsock,msg,(int32_t)strlen(msg)+1,0)) < 0 )
{ {
pubp->pairsock = -1; pubp->pairsock = -1;
LP_peer_pairsock(pubkey);
printf("mark cmdchannel %d closed sentbytes.%d\n",pubp->pairsock,sentbytes); printf("mark cmdchannel %d closed sentbytes.%d\n",pubp->pairsock,sentbytes);
} }
else else

16
iguana/exchanges/LP_peers.c

@ -92,6 +92,22 @@ void LP_cmdchannels()
} }
} }
void LP_peer_pairsock(bits256 pubkey)
{
struct LP_peerinfo *peer,*tmp;
if ( IAMLP == 0 )
{
HASH_ITER(hh,LP_peerinfos,peer,tmp)
{
if ( bits256_cmp(pubkey,peer->pubkey) == 0 )
{
LP_cmdchannel(peer);
break;
}
}
}
}
struct LP_peerinfo *LP_addpeer(struct LP_peerinfo *mypeer,int32_t mypubsock,char *ipaddr,uint16_t port,uint16_t pushport,uint16_t subport,int32_t isLP,uint32_t sessionid,uint16_t netid) struct LP_peerinfo *LP_addpeer(struct LP_peerinfo *mypeer,int32_t mypubsock,char *ipaddr,uint16_t port,uint16_t pushport,uint16_t subport,int32_t isLP,uint32_t sessionid,uint16_t netid)
{ {
uint32_t ipbits; int32_t valid,pushsock,subsock,timeout; char checkip[64],pushaddr[64],subaddr[64]; struct LP_peerinfo *peer = 0; uint32_t ipbits; int32_t valid,pushsock,subsock,timeout; char checkip[64],pushaddr[64],subaddr[64]; struct LP_peerinfo *peer = 0;

10
iguana/exchanges/LP_utxo.c

@ -447,10 +447,8 @@ struct LP_address *LP_address_utxo_reset(struct iguana_info *coin)
{ {
struct LP_address *ap; struct LP_address_utxo *up,*tmp; int32_t i,n,m,vout,height; cJSON *array,*item,*txobj; bits256 zero; int64_t value; bits256 txid; uint32_t now; struct LP_address *ap; struct LP_address_utxo *up,*tmp; int32_t i,n,m,vout,height; cJSON *array,*item,*txobj; bits256 zero; int64_t value; bits256 txid; uint32_t now;
LP_address(coin,coin->smartaddr); LP_address(coin,coin->smartaddr);
printf("call listunspent issue %s (%s)\n",coin->symbol,coin->smartaddr);
memset(zero.bytes,0,sizeof(zero)); memset(zero.bytes,0,sizeof(zero));
LP_listunspent_issue(coin->symbol,coin->smartaddr,2,zero,zero); LP_listunspent_issue(coin->symbol,coin->smartaddr,2,zero,zero);
printf("back from listunspent\n");
if ( (ap= LP_addressfind(coin,coin->smartaddr)) == 0 ) if ( (ap= LP_addressfind(coin,coin->smartaddr)) == 0 )
{ {
printf("LP_address_utxo_reset: cant find address data\n"); printf("LP_address_utxo_reset: cant find address data\n");
@ -461,7 +459,7 @@ struct LP_address *LP_address_utxo_reset(struct iguana_info *coin)
coin->lastresetutxo = (uint32_t)time(NULL); coin->lastresetutxo = (uint32_t)time(NULL);
if ( (array= LP_listunspent(coin->symbol,coin->smartaddr,zero,zero)) != 0 ) if ( (array= LP_listunspent(coin->symbol,coin->smartaddr,zero,zero)) != 0 )
{ {
printf("clear ap->utxos\n"); //printf("clear ap->utxos\n");
DL_FOREACH_SAFE(ap->utxos,up,tmp) DL_FOREACH_SAFE(ap->utxos,up,tmp)
{ {
portable_mutex_lock(&coin->addrmutex); portable_mutex_lock(&coin->addrmutex);
@ -472,7 +470,7 @@ struct LP_address *LP_address_utxo_reset(struct iguana_info *coin)
DL_APPEND(LP_garbage_collector2,up); DL_APPEND(LP_garbage_collector2,up);
portable_mutex_unlock(&LP_gcmutex); portable_mutex_unlock(&LP_gcmutex);
} }
printf("done clearing ap->utxos\n"); //printf("done clearing ap->utxos\n");
now = (uint32_t)time(NULL); now = (uint32_t)time(NULL);
if ( (n= cJSON_GetArraySize(array)) > 0 ) if ( (n= cJSON_GetArraySize(array)) > 0 )
{ {
@ -493,10 +491,10 @@ struct LP_address *LP_address_utxo_reset(struct iguana_info *coin)
else else
{ {
m++; m++;
printf("%.8f ",dstr(value)); //printf("%.8f ",dstr(value));
} }
} }
printf("added %d from listunspents\n",m); //printf("added %d from listunspents\n",m);
} }
free_json(array); free_json(array);
} }

Loading…
Cancel
Save