Browse Source

Merge pull request #452 from jl777/spvdex

Test
etomic
jl777 7 years ago
committed by GitHub
parent
commit
ef0e9af98c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      iguana/exchanges/LP_include.h
  2. 2
      iguana/exchanges/LP_portfolio.c
  3. 23
      iguana/exchanges/LP_rpc.c
  4. 23
      iguana/exchanges/LP_statemachine.c

2
iguana/exchanges/LP_include.h

@ -38,7 +38,7 @@ void emscripten_usleep(int32_t x); // returns immediate, no sense for sleeping
#define LP_MAGICBITS 8
#define LP_HTTP_TIMEOUT 3 // 1 is too small due to edge cases of time(NULL)
#define LP_AUTOTRADE_TIMEOUT 20
#define LP_AUTOTRADE_TIMEOUT 30
#define ELECTRUM_TIMEOUT 5
#define LP_ELECTRUM_KEEPALIVE 60
#define LP_ELECTRUM_MAXERRORS 777

2
iguana/exchanges/LP_portfolio.c

@ -641,7 +641,7 @@ void prices_loop(void *ctx)
}
free(retstr);
}
sleep(60);
sleep(120);
}
}

23
iguana/exchanges/LP_rpc.c

@ -51,17 +51,6 @@ char *LP_isitme(char *destip,uint16_t destport)
} else return(0);
}
void LP_peer_request(char *destip,uint16_t destport,cJSON *argjson)
{
struct LP_peerinfo *peer; uint8_t *msg; int32_t msglen; uint32_t crc32;
peer = LP_peerfind((uint32_t)calc_ipbits(destip),destport);
msg = (void *)jprint(argjson,0);
msglen = (int32_t)strlen((char *)msg) + 1;
crc32 = calc_crc32(0,&msg[2],msglen - 2);
LP_queuesend(crc32,peer->pushsock,"","",msg,msglen);
free_json(argjson);
}
char *issue_LP_psock(char *destip,uint16_t destport,int32_t ispaired)
{
char url[512],*retstr;
@ -72,18 +61,6 @@ char *issue_LP_psock(char *destip,uint16_t destport,int32_t ispaired)
return(retstr);
}
void issue_LP_getpeers(char *destip,uint16_t destport)
{
cJSON *reqjson = cJSON_CreateObject();
jaddstr(reqjson,"method","getpeers");
LP_peer_request(destip,destport,reqjson);
/*char url[512],*retstr;
sprintf(url,"http://%s:%u/api/stats/getpeers?ipaddr=%s&port=%u&numpeers=%d",destip,destport,ipaddr,port,numpeers);
retstr = LP_issue_curl("getpeers",destip,port,url);
//printf("%s -> getpeers.(%s)\n",destip,retstr);
return(retstr);*/
}
char *LP_apicall(struct iguana_info *coin,char *method,char *params)
{
cJSON *retjson; char *retstr;

23
iguana/exchanges/LP_statemachine.c

@ -169,7 +169,28 @@ int32_t LP_peersparse(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipa
}
return(n);
}
void LP_peersquery(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipaddr,uint16_t destport,char *myipaddr,uint16_t myport)
void issue_LP_getpeers(char *destip,uint16_t destport)
{
cJSON *reqjson = cJSON_CreateObject();
jaddstr(reqjson,"method","getpeers");
LP_peer_request(destip,destport,reqjson);
/*char url[512],*retstr;
sprintf(url,"http://%s:%u/api/stats/getpeers?ipaddr=%s&port=%u&numpeers=%d",destip,destport,ipaddr,port,numpeers);
retstr = LP_issue_curl("getpeers",destip,port,url);
//printf("%s -> getpeers.(%s)\n",destip,retstr);
return(retstr);*/
}
void LP_peer_request(char *destip,uint16_t destport,cJSON *argjson)
{
struct LP_peerinfo *peer; uint8_t *msg; int32_t msglen; uint32_t crc32;
peer = LP_peerfind((uint32_t)calc_ipbits(destip),destport);
msg = (void *)jprint(argjson,0);
msglen = (int32_t)strlen((char *)msg) + 1;
crc32 = calc_crc32(0,&msg[2],msglen - 2);
LP_queuesend(crc32,peer->pushsock,"","",msg,msglen);
free_json(argjson);
}void LP_peersquery(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipaddr,uint16_t destport,char *myipaddr,uint16_t myport)
{
char *retstr; struct LP_peerinfo *peer,*tmp; bits256 zero; uint32_t now,flag = 0;
peer = LP_peerfind((uint32_t)calc_ipbits(destipaddr),destport);

Loading…
Cancel
Save