jl777 8 years ago
parent
commit
01d18eb8b5
  1. 1
      iguana/exchanges/LP_include.h
  2. 39
      iguana/exchanges/LP_nativeDEX.c

1
iguana/exchanges/LP_include.h

@ -306,6 +306,7 @@ int32_t LP_txheight(struct iguana_info *coin,bits256 txid);
int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout,uint64_t value,int32_t height,int32_t spendheight); int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout,uint64_t value,int32_t height,int32_t spendheight);
cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrumret); cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrumret);
void LP_postutxos(char *symbol,char *coinaddr); void LP_postutxos(char *symbol,char *coinaddr);
int32_t LP_listunspent_both(char *symbol,char *coinaddr);
uint16_t LP_randpeer(char *destip); uint16_t LP_randpeer(char *destip);
int32_t LP_butxo_findeither(bits256 txid,int32_t vout); int32_t LP_butxo_findeither(bits256 txid,int32_t vout);
cJSON *LP_listunspent(char *symbol,char *coinaddr); cJSON *LP_listunspent(char *symbol,char *coinaddr);

39
iguana/exchanges/LP_nativeDEX.c

@ -343,22 +343,6 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
free(retstr); free(retstr);
peer->needping = 0; peer->needping = 0;
} }
HASH_ITER(hh,LP_coins,coin,ctmp)
{
char coinaddr[64]; cJSON *array; int32_t n;
bitcoin_address(coinaddr,coin->taddr,coin->pubtype,G.LP_myrmd160,sizeof(G.LP_myrmd160));
if ( (array= LP_address_utxos(coin,coinaddr,1)) != 0 )
{
if ( (n= cJSON_GetArraySize(array)) > 0 )
{
if ( (retstr= issue_LP_listunspent(peer->ipaddr,peer->port,coin->symbol,coinaddr)) != 0 )
{
printf("compare (%s) vs (%s)\n",jprint(array,0),retstr);
free(retstr);
}
}
free_json(array);
}
//sync listunspent,, spv //sync listunspent,, spv
} }
} }
@ -374,8 +358,27 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
} }
HASH_ITER(hh,LP_coins,coin,ctmp) // firstrefht,firstscanht,lastscanht HASH_ITER(hh,LP_coins,coin,ctmp) // firstrefht,firstscanht,lastscanht
{ {
int32_t height; bits256 zero; //struct LP_address *ap,*atmp; struct LP_address_utxo *up,*utmp; int32_t height; bits256 zero; char coinaddr[64]; cJSON *array; int32_t n;
//printf("%s ref.%d scan.%d to %d, longest.%d\n",coin->symbol,coin->firstrefht,coin->firstscanht,coin->lastscanht,coin->longestchain); bitcoin_address(coinaddr,coin->taddr,coin->pubtype,G.LP_myrmd160,sizeof(G.LP_myrmd160));
LP_listunspent_both(coin->symbol,coinaddr);
if ( (array= LP_address_utxos(coin,coinaddr,1)) != 0 )
{
if ( (n= cJSON_GetArraySize(array)) > 0 )
{
HASH_ITER(hh,LP_peerinfos,peer,tmp)
{
if ( peer->errors < LP_MAXPEER_ERRORS )
{
if ( (retstr= issue_LP_listunspent(peer->ipaddr,peer->port,coin->symbol,coinaddr)) != 0 )
{
printf(">>>>>>>> compare (%s) vs (%s)\n",jprint(array,0),retstr);
free(retstr);
}
}
}
}
free_json(array);
}
if ( coin->inactive != 0 ) if ( coin->inactive != 0 )
continue; continue;
if ( coin->electrum != 0 ) if ( coin->electrum != 0 )

Loading…
Cancel
Save