Browse Source

test

etomic
jl777 7 years ago
parent
commit
32a9c0f108
  1. 2
      iguana/exchanges/LP_commands.c
  2. 5
      iguana/exchanges/LP_include.h
  3. 6
      iguana/exchanges/LP_peers.c
  4. 5
      iguana/exchanges/LP_prices.c

2
iguana/exchanges/LP_commands.c

@ -523,7 +523,7 @@ bot_resume(botid)\n\
bits256 pub; static uint32_t lastnotify;
pub = jbits256(argjson,"pub");
//char str[65]; printf("got wantnotify.(%s) vs %s\n",jprint(argjson,0),bits256_str(str,G.LP_mypub25519));
if ( bits256_cmp(pub,G.LP_mypub25519) == 0 && time(NULL) > lastnotify+30 )
if ( bits256_cmp(pub,G.LP_mypub25519) == 0 && time(NULL) > lastnotify+60 )
{
lastnotify = (uint32_t)time(NULL);
//printf("wantnotify for me!\n");

5
iguana/exchanges/LP_include.h

@ -44,6 +44,9 @@ void emscripten_usleep(int32_t x); // returns immediate, no sense for sleeping
#define LP_ELECTRUM_MAXERRORS 777
#define LP_MEMPOOL_TIMEINCR 10
#define LP_OPTIONAL_PEERS 16
#define LP_MAX_PEERS 100
// RTmetrics
#define LP_RTMETRICS_TOPGROUP 1.01
#define LP_MAXPENDING_SWAPS 13
@ -350,7 +353,7 @@ struct LP_pubkeyinfo
bits256 pubkey;
float matrix[LP_MAXPRICEINFOS][LP_MAXPRICEINFOS];
//uint32_t timestamps[LP_MAXPRICEINFOS][LP_MAXPRICEINFOS];
uint32_t timestamp,numerrors;
uint32_t timestamp,numerrors,lasttime;
int32_t istrusted;
uint8_t rmd160[20],sig[65],pubsecp[33],siglen;
};

6
iguana/exchanges/LP_peers.c

@ -204,7 +204,7 @@ int32_t LP_coinbus(uint16_t coin_busport)
int32_t LP_peersparse(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipaddr,uint16_t destport,char *retstr,uint32_t now)
{
struct LP_peerinfo *peer; uint32_t argipbits; char *argipaddr; uint16_t argport,pushport,subport; cJSON *array,*item; int32_t i,n=0;
struct LP_peerinfo *peer; uint32_t argipbits; char *argipaddr; uint16_t argport,pushport,subport; cJSON *array,*item; int32_t numpeers,i,n=0;
if ( (array= cJSON_Parse(retstr)) != 0 )
{
if ( (n= cJSON_GetArraySize(array)) > 0 )
@ -221,7 +221,9 @@ int32_t LP_peersparse(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipa
argipbits = (uint32_t)calc_ipbits(argipaddr);
if ( (peer= LP_peerfind(argipbits,argport)) == 0 )
{
peer = LP_addpeer(mypeer,mypubsock,argipaddr,argport,pushport,subport,jint(item,"numpeers"),jint(item,"numutxos"),juint(item,"session"));
numpeers = LP_numpeers();
if ( IAMLP != 0 || (IAMLP == 0 && numpeers > LP_OPTIONAL_PEERS && (rand() % LP_MAX_PEERS) > numpeers) )
peer = LP_addpeer(mypeer,mypubsock,argipaddr,argport,pushport,subport,jint(item,"numpeers"),jint(item,"numutxos"),juint(item,"session"));
}
if ( peer != 0 )
{

5
iguana/exchanges/LP_prices.c

@ -697,15 +697,14 @@ struct LP_orderbookentry *LP_orderbookentry(char *address,char *base,char *rel,d
void LP_pubkeys_query()
{
static uint32_t lasttime;
uint8_t zeroes[20]; bits256 zero; cJSON *reqjson; struct LP_pubkeyinfo *pubp=0,*tmp;
memset(zero.bytes,0,sizeof(zero));
memset(zeroes,0,sizeof(zeroes));
HASH_ITER(hh,LP_pubkeyinfos,pubp,tmp)
{
if ( memcmp(zeroes,pubp->rmd160,sizeof(pubp->rmd160)) == 0 && time(NULL) > lasttime+30 )
if ( memcmp(zeroes,pubp->rmd160,sizeof(pubp->rmd160)) == 0 && time(NULL) > pubp->lasttime+60 )
{
lasttime = (uint32_t)time(NULL);
pubp->lasttime = (uint32_t)time(NULL);
reqjson = cJSON_CreateObject();
jaddstr(reqjson,"method","wantnotify");
jaddbits256(reqjson,"pub",pubp->pubkey);

Loading…
Cancel
Save