Browse Source

Merge branch 'dev' of https://github.com/jl777/SuperNET into dev-decker-dev

etomic
DeckerSU 7 years ago
parent
commit
c6421d1139
  1. 1
      crypto777/OS_portable.h
  2. 73
      crypto777/bitcoind_RPC.c
  3. 6
      crypto777/cJSON.c
  4. 2
      crypto777/iguana_utils.c
  5. 7
      iguana/exchanges/LP_commands.c
  6. 2
      iguana/exchanges/LP_include.h
  7. 96
      iguana/exchanges/LP_nativeDEX.c
  8. 16
      iguana/exchanges/LP_ordermatch.c
  9. 1
      iguana/exchanges/LP_prices.c
  10. 9
      iguana/exchanges/LP_rpc.c
  11. 2
      iguana/exchanges/LP_socket.c
  12. 10
      iguana/exchanges/LP_statemachine.c
  13. 12
      iguana/exchanges/LP_transaction.c
  14. 9
      iguana/exchanges/LP_utxo.c
  15. 9
      iguana/exchanges/LP_utxos.c
  16. 10
      iguana/exchanges/mm.c
  17. 2
      iguana/exchanges/stats.c

1
crypto777/OS_portable.h

@ -276,6 +276,7 @@ void *queue_delete(queue_t *queue,struct queueitem *copy,int32_t copysize,int32_
void *queue_free(queue_t *queue);
void *queue_clone(queue_t *clone,queue_t *queue,int32_t size);
int32_t queue_size(queue_t *queue);
char *mbstr(char *str,double n);
void iguana_memreset(struct OS_memspace *mem);
void iguana_mempurge(struct OS_memspace *mem);

73
crypto777/bitcoind_RPC.c

@ -13,10 +13,24 @@
* *
******************************************************************************/
#ifndef FROM_JS
#include "OS_portable.h"
#define LIQUIDITY_PROVIDER 1
/*#define malloc(n) LP_alloc(n)
#define realloc(ptr,n) LP_realloc(ptr,n)
#define calloc(a,b) LP_alloc((uint64_t)(a) * (b))
#define free(ptr) LP_free(ptr)
#define clonestr(str) LP_clonestr(str)
void *LP_realloc(void *ptr,uint64_t len);
void *LP_alloc(uint64_t len);
void LP_free(void *ptr);
char *LP_clonestr(char *str);*/
#if LIQUIDITY_PROVIDER
#include <curl/curl.h>
#include <curl/easy.h>
@ -31,8 +45,11 @@ struct return_string {
size_t len;
};
struct MemoryStruct { char *memory; size_t size,allocsize; };
size_t accumulate(void *ptr, size_t size, size_t nmemb, struct return_string *s);
void init_string(struct return_string *s);
static size_t WriteMemoryCallback(void *ptr,size_t size,size_t nmemb,void *data);
/************************************************************************
@ -78,7 +95,7 @@ char *post_process_bitcoind_RPC(char *debugstr,char *command,char *rpcstr,char *
{
if ( (error->type&0xff) == cJSON_NULL && (result->type&0xff) != cJSON_NULL )
{
retstr = cJSON_Print(result);
retstr = jprint(result,0);
len = strlen(retstr);
if ( retstr[0] == '"' && retstr[len-1] == '"' )
{
@ -122,8 +139,9 @@ char *Jay_NXTrequest(char *command,char *params)
char *bitcoind_RPC(char **retstrp,char *debugstr,char *url,char *userpass,char *command,char *params,int32_t timeout)
{
static int didinit,count,count2; static double elapsedsum,elapsedsum2; extern int32_t USE_JAY;
struct MemoryStruct chunk;
struct curl_slist *headers = NULL; struct return_string s; CURLcode res; CURL *curl_handle;
char *bracket0,*bracket1,*databuf = 0; long len; int32_t specialcase,numretries; double starttime;
char *bracket0,*bracket1,*retstr,*databuf = 0; long len; int32_t specialcase,numretries; double starttime;
if ( didinit == 0 )
{
didinit = 1;
@ -147,14 +165,24 @@ try_again:
*retstrp = 0;
starttime = OS_milliseconds();
curl_handle = curl_easy_init();
init_string(&s);
headers = curl_slist_append(0,"Expect:");
curl_easy_setopt(curl_handle,CURLOPT_USERAGENT,"mozilla/4.0");//"Mozilla/4.0 (compatible; )");
curl_easy_setopt(curl_handle,CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl_handle,CURLOPT_URL, url);
curl_easy_setopt(curl_handle,CURLOPT_WRITEFUNCTION, (void *)accumulate); // send all data to this function
curl_easy_setopt(curl_handle,CURLOPT_WRITEDATA, &s); // we pass our 's' struct to the callback
if ( (0) )
{
init_string(&s);
curl_easy_setopt(curl_handle,CURLOPT_WRITEFUNCTION, (void *)accumulate); // send all data to this function
curl_easy_setopt(curl_handle,CURLOPT_WRITEDATA, &s); // we pass our 's' struct to the callback
}
else
{
memset(&chunk,0,sizeof(chunk));
curl_easy_setopt(curl_handle,CURLOPT_WRITEFUNCTION,WriteMemoryCallback);
curl_easy_setopt(curl_handle,CURLOPT_WRITEDATA,(void *)&chunk);
}
curl_easy_setopt(curl_handle,CURLOPT_NOSIGNAL, 1L); // supposed to fix "Alarm clock" and long jump crash
curl_easy_setopt(curl_handle,CURLOPT_NOPROGRESS, 1L); // no progress callback
if ( timeout > 0 )
@ -209,23 +237,24 @@ try_again:
if ( specialcase != 0 || timeout != 0 )
{
//printf("<<<<<<<<<<< bitcoind_RPC.(%s): BTCD.%s timeout params.(%s) s.ptr.(%s) err.%d\n",url,command,params,s.ptr,res);
free(s.ptr);
free(chunk.memory); //free(s.ptr);
return(0);
}
else if ( numretries >= 4 )
{
printf( "curl_easy_perform() failed: %s %s.(%s %s), retries: %d\n",curl_easy_strerror(res),debugstr,url,command,numretries);
//printf("Maximum number of retries exceeded!\n");
free(s.ptr);
free(chunk.memory);//free(s.ptr);
return(0);
}
free(s.ptr);
free(chunk.memory);//free(s.ptr);
sleep((1<<numretries));
goto try_again;
}
else
{
retstr = chunk.memory; // retstr = s.ptr;
if ( command != 0 && specialcase == 0 )
{
count++;
@ -234,20 +263,20 @@ try_again:
printf("%d: ave %9.6f | elapsed %.3f millis | bitcoind_RPC.(%s) url.(%s)\n",count,elapsedsum/count,(OS_milliseconds() - starttime),command,url);
if ( retstrp != 0 )
{
*retstrp = s.ptr;
return(s.ptr);
*retstrp = retstr;
return(retstr);
}
return(post_process_bitcoind_RPC(debugstr,command,s.ptr,params));
return(post_process_bitcoind_RPC(debugstr,command,retstr,params));
}
else
{
if ( (0) && specialcase != 0 )
fprintf(stderr,"<<<<<<<<<<< bitcoind_RPC: BTCD.(%s) -> (%s)\n",params,s.ptr);
fprintf(stderr,"<<<<<<<<<<< bitcoind_RPC: BTCD.(%s) -> (%s)\n",params,retstr);
count2++;
elapsedsum2 += (OS_milliseconds() - starttime);
if ( (count2 % 10000) == 0)
printf("%d: ave %9.6f | elapsed %.3f millis | NXT calls.(%s) cmd.(%s)\n",count2,elapsedsum2/count2,(double)(OS_milliseconds() - starttime),url,command);
return(s.ptr);
return(retstr);
}
}
//printf("bitcoind_RPC: impossible case\n");
@ -294,13 +323,23 @@ size_t accumulate(void *ptr,size_t size,size_t nmemb,struct return_string *s)
return(size * nmemb);
}
struct MemoryStruct { char *memory; size_t size; };
static size_t WriteMemoryCallback(void *ptr,size_t size,size_t nmemb,void *data)
{
size_t realsize = (size * nmemb);
size_t needed,realsize = (size * nmemb);
struct MemoryStruct *mem = (struct MemoryStruct *)data;
mem->memory = (ptr != 0) ? realloc(mem->memory,mem->size + realsize + 1) : malloc(mem->size + realsize + 1);
needed = mem->size + realsize + 1;
if ( ptr == 0 && needed < 256 )
{
mem->allocsize = 256;
mem->memory = malloc(mem->allocsize);
}
if ( mem->allocsize < needed )
{
//printf("curl needs %d more\n",(int32_t)realsize);
mem->memory = (ptr != 0) ? realloc(mem->memory,needed) : malloc(needed);
mem->allocsize = needed;
}
//mem->memory = (ptr != 0) ? realloc(mem->memory,mem->size + realsize + 1) : malloc(mem->size + realsize + 1);
if ( mem->memory != 0 )
{
if ( ptr != 0 )

6
crypto777/cJSON.c

@ -54,8 +54,10 @@ static int32_t cJSON_strcasecmp(const char *s1,const char *s2)
return tolower((int32_t)(*(const unsigned char *)s1)) - tolower((int32_t)(*(const unsigned char *)s2));
}
static void *(*cJSON_malloc)(size_t sz) = malloc;
static void (*cJSON_free)(void *ptr) = free;
void *LP_alloc(uint64_t len);
void LP_free(void *ptr);
static void *(*cJSON_malloc)(size_t sz) = (void *)LP_alloc;
static void (*cJSON_free)(void *ptr) = LP_free;
static char* cJSON_strdup(const char* str)
{

2
crypto777/iguana_utils.c

@ -446,8 +446,6 @@ char *clonestr(char *str)
return(clone);
}
int32_t zeroval() { return(0); }
int32_t safecopy(char *dest,char *src,long len)
{
int32_t i = -1;

7
iguana/exchanges/LP_commands.c

@ -36,11 +36,6 @@ char *stats_JSON(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,char *r
{
char *method,*userpass,*base,*rel,*coin,*retstr = 0; int32_t changed,flag = 0; cJSON *retjson,*reqjson = 0; struct iguana_info *ptr;
method = jstr(argjson,"method");
/*if ( //strcmp(method,"uitem") == 0 || strcmp(method,"postutxos") == 0 ||
strcmp(method,"notify") == 0
|| strcmp(method,"postprice") == 0
)
return(clonestr("{}"));*/
/*if ( (ipaddr= jstr(argjson,"ipaddr")) != 0 && (argport= juint(argjson,"port")) != 0 && (method == 0 || strcmp(method,"electrum") != 0) )
{
if ( strcmp(ipaddr,"127.0.0.1") != 0 && argport >= 1000 )
@ -435,7 +430,7 @@ bot_resume(botid)\n\
}
else if ( strcmp(method,"getrawtransaction") == 0 )
{
return(jprint(LP_gettx(coin,jbits256(argjson,"txid")),0));
return(jprint(LP_gettx(coin,jbits256(argjson,"txid")),1));
}
else if ( strcmp(method,"withdraw") == 0 )
{

2
iguana/exchanges/LP_include.h

@ -275,7 +275,7 @@ struct iguana_info
void *electrum; void *ctx;
uint64_t maxamount,kmd_equiv,balanceA,balanceB,valuesumA,valuesumB;
uint8_t pubkey33[33],zcash;
bits256 lastprivkey; uint32_t lastprivkeytime; int32_t privkeydepth;
int32_t privkeydepth;
bits256 cachedtxid; uint8_t *cachedtxiddata; int32_t cachedtxidlen;
bits256 cachedmerkle; int32_t cachedmerkleheight;
};

96
iguana/exchanges/LP_nativeDEX.c

@ -17,8 +17,6 @@
// LP_nativeDEX.c
// marketmaker
//
// more retries for swap sendrawtransaction?
// pbca26 unfinished swaps
// if ( G.LP_pendingswaps != 0 ) return(-1);
// bot safe to exit?
//
@ -30,6 +28,9 @@
// bigendian architectures need to use little endian for sighash calcs
#include <stdio.h>
long LP_cjson_allocated,LP_cjson_total,LP_cjson_count;
struct LP_millistats
{
double lastmilli,millisum,threshold;
@ -311,7 +312,6 @@ char *LP_process_message(void *ctx,char *typestr,char *myipaddr,int32_t pubsock,
if ( (retstr= LP_command_process(ctx,myipaddr,pubsock,argjson,&((uint8_t *)ptr)[len],recvlen - len)) != 0 )
{
}
//printf("%.3f %s LP_command_process\n",OS_milliseconds()-millis,jstr(argjson,"method"));
}
}
if ( argjson != 0 )
@ -1190,4 +1190,94 @@ void LP_fromjs_iter()
#endif
#undef calloc
#undef free
#undef realloc
#undef clonestr
struct LP_memory_list
{
struct LP_memory_list *next,*prev;
uint32_t timestamp,len;
void *ptr;
} *LP_memory_list;
int32_t zeroval() { return(0); }
void *LP_alloc(uint64_t len)
{
return(calloc(1,len));
LP_cjson_allocated += len;
LP_cjson_total += len;
LP_cjson_count++;
struct LP_memory_list *mp;
mp = calloc(1,sizeof(*mp) + len);
mp->ptr = calloc(1,len);
printf(">>>>>>>>>>> LP_alloc mp.%p ptr.%p len.%llu %llu\n",mp,mp->ptr,(long long)len,(long long)LP_cjson_allocated);
mp->timestamp = (uint32_t)time(NULL);
mp->len = (uint32_t)len;
portable_mutex_lock(&LP_cJSONmutex);
DL_APPEND(LP_memory_list,mp);
portable_mutex_unlock(&LP_cJSONmutex);
return(mp->ptr);
}
void LP_free(void *ptr)
{
static uint32_t lasttime,unknown;
free(ptr);
return;
uint32_t now; char str[65]; int32_t n,lagging; uint64_t total = 0; struct LP_memory_list *mp,*tmp;
if ( (now= (uint32_t)time(NULL)) > lasttime+60 )
{
n = lagging = 0;
DL_FOREACH_SAFE(LP_memory_list,mp,tmp)
{
total += mp->len;
n++;
if ( 0 && now > mp->timestamp+60 )
{
lagging++;
if ( now > mp->timestamp+60 )
{
portable_mutex_lock(&LP_cJSONmutex);
DL_DELETE(LP_memory_list,mp);
portable_mutex_unlock(&LP_cJSONmutex);
free(mp->ptr);
free(mp);
}
}
}
printf("total %d allocated total %llu/%llu [%llu %llu] %.1f ave %s unknown.%u lagging.%d\n",n,(long long)total,(long long)LP_cjson_allocated,(long long)LP_cjson_total,(long long)LP_cjson_count,(double)LP_cjson_total/LP_cjson_count,mbstr(str,total),unknown,lagging);
lasttime = (uint32_t)time(NULL);
}
DL_FOREACH_SAFE(LP_memory_list,mp,tmp)
{
if ( mp->ptr == ptr )
break;
mp = 0;
}
if ( mp != 0 )
{
LP_cjson_allocated -= mp->len;
portable_mutex_lock(&LP_cJSONmutex);
DL_DELETE(LP_memory_list,mp);
portable_mutex_unlock(&LP_cJSONmutex);
printf(">>>>>>>>>>> LP_free ptr.%p mp.%p len.%u %llu\n",ptr,mp,mp->len,(long long)LP_cjson_allocated);
free(mp->ptr);
free(mp);
} else unknown++; // free from source file with #define redirect for alloc that wasnt
}
char *LP_clonestr(char *str)
{
char *retstr = LP_alloc(strlen(str)+1);
strcpy(retstr,str);
return(retstr);
}
void *LP_realloc(void *ptr,uint64_t len)
{
return(realloc(ptr,len));
}

16
iguana/exchanges/LP_ordermatch.c

@ -571,7 +571,14 @@ char *LP_connectedalice(cJSON *argjson) // alice
LP_aliceid(Q.tradeid,Q.aliceid,"error1",0,0);
return(clonestr("{\"result\",\"update stats\"}"));
}
printf("CONNECTED.(%s) numpending.%d tradeid.%u\n",jprint(argjson,0),G.LP_pendingswaps,Q.tradeid);
printf("CONNECTED.(%s) numpending.%d tradeid.%u requestid.%u quoteid.%u\n",jprint(argjson,0),G.LP_pendingswaps,Q.tradeid,Q.R.requestid,Q.R.quoteid);
if ( LP_pendingswap(Q.R.requestid,Q.R.quoteid) > 0 )
{
printf("requestid.%u quoteid.%u is already in progres\n",Q.R.requestid,Q.R.quoteid);
retjson = cJSON_CreateObject();
jaddstr(retjson,"error","swap already in progress");
return(jprint(retjson,1));
}
if ( (autxo= LP_utxopairfind(0,Q.desttxid,Q.destvout,Q.feetxid,Q.feevout)) == 0 )
{
printf("cant find autxo\n");
@ -616,12 +623,6 @@ char *LP_connectedalice(cJSON *argjson) // alice
{
retjson = cJSON_CreateObject();
LP_requestinit(&Q.R,Q.srchash,Q.desthash,Q.srccoin,Q.satoshis-Q.txfee,Q.destcoin,Q.destsatoshis-Q.desttxfee,Q.timestamp,Q.quotetime,DEXselector);
if ( LP_pendingswap(Q.R.requestid,Q.R.quoteid) > 0 )
{
printf("requestid.%u quoteid.%u is already in progres\n",Q.R.requestid,Q.R.quoteid);
jaddstr(retjson,"error","swap already in progress");
return(jprint(retjson,1));
}
if ( (swap= LP_swapinit(0,0,Q.privkey,&Q.R,&Q)) == 0 )
{
jaddstr(retjson,"error","couldnt swapinit");
@ -717,6 +718,7 @@ int32_t LP_listunspent_both(char *symbol,char *coinaddr,int32_t fullflag)
LP_address_utxoadd(now,"LP_listunspent_both",coin,coinaddr,txid,v,value,height,-1);
}
}
free_json(array);
}
}
} //else printf("%s coin.%p inactive.%d\n",symbol,coin,coin!=0?coin->inactive:-1);

1
iguana/exchanges/LP_prices.c

@ -265,6 +265,7 @@ uint64_t LP_unspents_metric(struct iguana_info *coin,char *coinaddr)
}
}
metric = _LP_unspents_metric(total,n);
free_json(array);
}
return(metric);
}

9
iguana/exchanges/LP_rpc.c

@ -682,15 +682,6 @@ int32_t LP_listunspent_issue(char *symbol,char *coinaddr,int32_t fullflag)
{
//printf("LP_listunspent_query.(%s %s)\n",symbol,coinaddr);
LP_listunspent_query(coin->symbol,coin->smartaddr);
/*if ( fullflag != 0 )
{
if ( (destport= LP_randpeer(destip)) > 0 )
{
retstr = issue_LP_listunspent(destip,destport,symbol,coinaddr);
//printf("issue %s %s %s -> (%s)\n",coin->symbol,coinaddr,destip,retstr);
retjson = cJSON_Parse(retstr);
} else printf("LP_listunspent_issue couldnt get a random peer?\n");
}*/
}
if ( retjson != 0 )
{

2
iguana/exchanges/LP_socket.c

@ -1034,7 +1034,7 @@ cJSON *LP_electrumserver(struct iguana_info *coin,char *ipaddr,uint16_t port)
retjson = cJSON_CreateObject();
jaddstr(retjson,"ipaddr",ipaddr);
jaddnum(retjson,"port",port);
if ( (ep= LP_electrum_info(&already,coin->symbol,ipaddr,port,IGUANA_MAXPACKETSIZE * 10)) == 0 )
if ( (ep= LP_electrum_info(&already,coin->symbol,ipaddr,port,IGUANA_MAXPACKETSIZE)) == 0 )
{
jaddstr(retjson,"error","couldnt connect to electrum server");
return(retjson);

10
iguana/exchanges/LP_statemachine.c

@ -355,6 +355,16 @@ char *issue_LP_getprices(char *destip,uint16_t destport)
return(LP_issue_curl("getprices",destip,destport,url));
//return(issue_curlt(url,LP_HTTP_TIMEOUT));
}
/*if ( fullflag != 0 )
{
if ( (destport= LP_randpeer(destip)) > 0 )
{
retstr = issue_LP_listunspent(destip,destport,symbol,coinaddr);
//printf("issue %s %s %s -> (%s)\n",coin->symbol,coinaddr,destip,retstr);
retjson = cJSON_Parse(retstr);
} else printf("LP_listunspent_issue couldnt get a random peer?\n");
}*/
void issue_LP_listunspent(char *destip,uint16_t destport,char *symbol,char *coinaddr)
{
cJSON *reqjson = cJSON_CreateObject();

12
iguana/exchanges/LP_transaction.c

@ -78,7 +78,8 @@ int32_t LP_gettx_presence(char *symbol,bits256 expectedtxid)
bits256 LP_broadcast(char *txname,char *symbol,char *txbytes,bits256 expectedtxid)
{
char *retstr; bits256 txid; uint8_t *ptr; cJSON *retjson,*errorobj; int32_t i,len,sentflag = 0;
char *retstr,*errstr; bits256 txid; uint8_t *ptr; cJSON *retjson,*errorobj; struct iguana_info *coin; int32_t i,totalretries=0,len,sentflag = 0;
coin = LP_coinfind(symbol);
memset(&txid,0,sizeof(txid));
if ( txbytes == 0 || txbytes[0] == 0 )
return(txid);
@ -115,6 +116,15 @@ bits256 LP_broadcast(char *txname,char *symbol,char *txbytes,bits256 expectedtxi
txid = expectedtxid;
sentflag = 1;
}
else if ( (errstr= jstr(retjson,"error")) != 0 && strcmp(errstr,"timeout") == 0 && coin != 0 && coin->electrum != 0 )
{
if ( totalretries < 10 )
{
printf("time error with electrum, retry.%d\n",totalretries);
totalretries++;
i--;
}
}
else printf("broadcast error.(%s)\n",retstr);
}
free_json(retjson);

9
iguana/exchanges/LP_utxo.c

@ -27,7 +27,7 @@ struct LP_inuse_info
} LP_inuse[1024];
int32_t LP_numinuse;
struct cJSON_list
/*struct cJSON_list
{
struct cJSON_list *next,*prev;
cJSON *item;
@ -47,7 +47,6 @@ void cJSON_register(cJSON *item)
portable_mutex_unlock(&LP_cJSONmutex);
}
char *mbstr(char *str,double n);
void cJSON_unregister(cJSON *item)
{
static uint32_t lasttime;
@ -92,7 +91,7 @@ void cJSON_unregister(cJSON *item)
free(ptr);
portable_mutex_unlock(&LP_cJSONmutex);
} //else printf("cJSON_unregister of unknown %p %u\n",item,item->cjsonid);
}
}*/
struct LP_inuse_info *_LP_inuse_find(bits256 txid,int32_t vout)
{
@ -504,7 +503,7 @@ struct LP_address *LP_address_utxo_reset(struct iguana_info *coin)
up->spendheight = (int32_t)time(NULL);
DL_APPEND(LP_garbage_collector2,up);
portable_mutex_unlock(&LP_gcmutex);
}
}
now = (uint32_t)time(NULL);
if ( (n= cJSON_GetArraySize(array)) > 0 )
{
@ -635,6 +634,7 @@ cJSON *LP_address_balance(struct iguana_info *coin,char *coinaddr,int32_t electr
balance += LP_value_extract(item,1);
}
}
free_json(array);
}
}
else
@ -653,6 +653,7 @@ cJSON *LP_address_balance(struct iguana_info *coin,char *coinaddr,int32_t electr
balance += j64bits(item,"value");
}
}
free_json(array);
}
}
}

9
iguana/exchanges/LP_utxos.c

@ -568,19 +568,13 @@ int32_t LP_privkey_init(int32_t mypubsock,struct iguana_info *coin,bits256 mypri
//printf("coin not active\n");
return(0);
}
/*if ( bits256_cmp(myprivkey,coin->lastprivkey) == 0 && time(NULL) < coin->lastprivkeytime+60 )
return(0);*/
coin->lastprivkey = myprivkey;
coin->lastprivkeytime = (uint32_t)time(NULL);
if ( coin->privkeydepth > 0 )
return(0);
coin->privkeydepth++;
LP_address(coin,coin->smartaddr);
//printf("privkey init.(%s) %s depth.%d\n",coin->symbol,coin->smartaddr,coin->privkeydepth);
if ( coin->inactive == 0 )
LP_listunspent_issue(coin->symbol,coin->smartaddr,0);
array = LP_listunspent(coin->symbol,coin->smartaddr);
//printf("unspent array %ld\n",strlen(jprint(array,0)));
if ( array != 0 )
{
txfee = LP_txfeecalc(coin,0,0);
@ -820,7 +814,8 @@ bits256 LP_privkeycalc(void *ctx,uint8_t *pubkey33,bits256 *pubkeyp,struct iguan
printf("cant importprivkey.%s -> (%s), abort session\n",coin->symbol,jprint(retjson,1));
exit(-1);
}
} else free_json(retjson);
free_json(retjson);
}
coin->importedprivkey = (uint32_t)time(NULL);
}
vcalc_sha256(0,checkkey.bytes,privkey.bytes,sizeof(privkey));

10
iguana/exchanges/mm.c

@ -19,10 +19,7 @@
// Copyright © 2017 SuperNET. All rights reserved.
//
/*
#define malloc(n) LP_alloc(n)
#define calloc(a,b) LP_alloc((uint64_t)(a) * (b))
#define free(ptr) LP_free(ptr)*/
void PNACL_message(char *arg,...)
{
@ -30,10 +27,6 @@ void PNACL_message(char *arg,...)
}
#define FROM_MARKETMAKER
#ifndef CJSON_GARBAGECOLLECTION
#define CJSON_GARBAGECOLLECTION
#endif
#include <stdio.h>
#include <stdint.h>
#ifndef NATIVE_WINDOWS
@ -42,7 +35,6 @@ void PNACL_message(char *arg,...)
#include "../../crypto777/OS_portable.h"
#endif // !_WIN_32
#define MAX(a,b) ((a) > (b) ? (a) : (b))
char *stats_JSON(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,char *remoteaddr,uint16_t port);
#include "stats.c"

2
iguana/exchanges/stats.c

@ -529,7 +529,7 @@ char *stats_rpcparse(char *retbuf,int32_t bufsize,int32_t *jsonflagp,int32_t *po
free(retstr);
}
#endif
//printf("(%s) {%s} -> (%s) postflag.%d (%s)\n",urlstr,jprint(argjson,0),cJSON_Print(json),*postflagp,retstr);
//printf("(%s) {%s} -> (%s) postflag.%d (%s)\n",urlstr,jprint(argjson,0),jprint(json,0),*postflagp,retstr);
}
free_json(origargjson);
retstr = jprint(retarray,1);

Loading…
Cancel
Save