jl777 7 years ago
parent
commit
e49443e9be
  1. 30
      iguana/exchanges/LP_nativeDEX.c
  2. 24
      iguana/exchanges/LP_statemachine.c
  3. 25
      iguana/exchanges/LP_utxo.c

30
iguana/exchanges/LP_nativeDEX.c

@ -357,7 +357,8 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
}
HASH_ITER(hh,LP_coins,coin,ctmp) // firstrefht,firstscanht,lastscanht
{
int32_t height,i,n,m,post; bits256 zero; cJSON *array,*item,*array2; uint64_t total,total2;
int32_t height,i,j,n,m,v,post; bits256 zero,txid,txid2; cJSON *array,*item,*item2,*array2; uint64_t total,total2;
memset(&zero,0,sizeof(zero));
if ( coin->inactive != 0 )
continue;
if ( (rand() % 100) == 0 )
@ -387,18 +388,33 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
if ( (m= cJSON_GetArraySize(array2)) > 0 )
{
for (i=0; i<m; i++)
{
item2 = jitem(array2,i);
total2 += j64bits(item2,"value");
}
}
if ( total != total2 || n != m )
{
printf(">>>>>>>> %s compare %s %s (%.8f n%d) (%.8f m%d)\n",peer->ipaddr,coin->symbol,coin->smartaddr,dstr(total),n,dstr(total2),m);
for (i=0; i<n; i++)
{
item = jitem(array,i);
total2 += j64bits(item,"value");
txid = jbits256(item,"tx_hash");
v = jint(item,"tx_pos");
for (j=0; j<m; j++)
{
if ( v == jint(jitem(array2,i),"tx_pos") && bits256_cmp(txid,jbits256(jitem(array2,i),"tx_hash")) == 0 )
break;
}
if ( j == m )
{
printf("%s missing %s\n",peer->ipaddr,jprint(item,0));
}
}
post++;
}
free_json(array2);
}
if ( total != total2 || n != m )
{
printf(">>>>>>>> %s compare %s %s (%.8f n%d) (%.8f m%d)\n",peer->ipaddr,coin->symbol,coin->smartaddr,dstr(total),n,dstr(total2),m);
post++;
}
free(retstr);
}
}

24
iguana/exchanges/LP_statemachine.c

@ -1527,6 +1527,30 @@ char *issue_LP_clientgetutxos(char *destip,uint16_t destport,char *coin,int32_t
//printf("%s clientgetutxos.(%s)\n",url,retstr);
//return(retstr);
}
void LP_address_monitor(struct LP_pubkeyinfo *pubp)
{
struct iguana_info *coin,*tmp; char coinaddr[64]; cJSON *retjson; struct LP_address *ap;
return;
HASH_ITER(hh,LP_coins,coin,tmp)
{
bitcoin_address(coinaddr,coin->taddr,coin->pubtype,pubp->rmd160,sizeof(pubp->rmd160));
portable_mutex_lock(&coin->addrmutex);
if ( (ap= _LP_address(coin,coinaddr)) != 0 )
{
ap->monitor = (uint32_t)time(NULL);
}
portable_mutex_unlock(&coin->addrmutex);
if ( coin->electrum != 0 )
{
if ( (retjson= electrum_address_subscribe(coin->symbol,coin->electrum,&retjson,coinaddr)) != 0 )
{
printf("%s MONITOR.(%s) -> %s\n",coin->symbol,coinaddr,jprint(retjson,0));
free_json(retjson);
}
}
}
}
/*else if ( strcmp(method,"ordermatch") == 0 )
{
if ( price > SMALLVAL )

25
iguana/exchanges/LP_utxo.c

@ -331,31 +331,6 @@ char *LP_postedutxos(cJSON *argjson)
return(clonestr("{\"result\":\"success\"}"));
}
/*void LP_address_monitor(struct LP_pubkeyinfo *pubp)
{
struct iguana_info *coin,*tmp; char coinaddr[64]; cJSON *retjson; struct LP_address *ap;
return;
HASH_ITER(hh,LP_coins,coin,tmp)
{
bitcoin_address(coinaddr,coin->taddr,coin->pubtype,pubp->rmd160,sizeof(pubp->rmd160));
portable_mutex_lock(&coin->addrmutex);
if ( (ap= _LP_address(coin,coinaddr)) != 0 )
{
ap->monitor = (uint32_t)time(NULL);
}
portable_mutex_unlock(&coin->addrmutex);
if ( coin->electrum != 0 )
{
if ( (retjson= electrum_address_subscribe(coin->symbol,coin->electrum,&retjson,coinaddr)) != 0 )
{
printf("%s MONITOR.(%s) -> %s\n",coin->symbol,coinaddr,jprint(retjson,0));
free_json(retjson);
}
}
}
}
*/
void LP_utxosetkey(uint8_t *key,bits256 txid,int32_t vout)
{
memcpy(key,txid.bytes,sizeof(txid));

Loading…
Cancel
Save