Browse Source

cache instantdex credit calc

dev
jl777 7 years ago
parent
commit
3dfb36d296
  1. 2
      crypto777/bitcoind_RPC.c
  2. 2
      iguana/exchanges/LP_include.h
  3. 4
      iguana/exchanges/LP_instantdex.c

2
crypto777/bitcoind_RPC.c

@ -74,7 +74,7 @@ char *post_process_bitcoind_RPC(char *debugstr,char *command,char *rpcstr,char *
char *retstr = 0;
cJSON *json,*result,*error;
#ifdef FROM_MARKETMAKER
usleep(500);
//usleep(500);
#endif
//printf("<<<<<<<<<<< bitcoind_RPC: %s post_process_bitcoind_RPC.%s.[%s]\n",debugstr,command,rpcstr);
if ( command == 0 || rpcstr == 0 || rpcstr[0] == 0 )

2
iguana/exchanges/LP_include.h

@ -351,7 +351,7 @@ struct LP_address
struct LP_address_utxo *utxos;
bits256 pubkey;
int64_t balance,total,instantdex_credits;
uint32_t timestamp,n,unspenttime;
uint32_t timestamp,n,unspenttime,instantdextime;
int32_t unspentheight;
char coinaddr[64];
uint8_t pubsecp[33],didinstantdex;

4
iguana/exchanges/LP_instantdex.c

@ -518,6 +518,9 @@ int64_t LP_instantdex_proofcheck(char *symbol,char *coinaddr,cJSON *proof,int32_
//printf("proofcheck addrtype.%d (%s) -> %s\n",addrtype,coinaddr,othersmartaddr);
if ((ap= LP_address(coin,othersmartaddr)) != 0 )
{
if ( time(NULL) < ap->instantdextime+300 )
return(ap->instantdex_credits);
ap->instantdextime = (uint32_t)time(NULL);
ap->instantdex_credits = 0;
for (i=0; i<num; i++)
{
@ -533,6 +536,7 @@ int64_t LP_instantdex_proofcheck(char *symbol,char *coinaddr,cJSON *proof,int32_
}
credits = ap->instantdex_credits;
ap->didinstantdex = 1;
ap->instantdextime = (uint32_t)time(NULL);
if ( 0 && ap->instantdex_credits > 0 )
printf("validated instantdex %s.[%d] proof.(%s) credits %.8f\n",othersmartaddr,num,jprint(proof,0),dstr(ap->instantdex_credits));
} //else printf("cant find ap.%p or already did %d %.8f\n",ap,ap!=0?ap->didinstantdex:-1,ap!=0?dstr(ap->instantdex_credits):-1);

Loading…
Cancel
Save