diff --git a/iguana/STEEM.c b/iguana/STEEM.c new file mode 100644 index 000000000..83b79f9f5 --- /dev/null +++ b/iguana/STEEM.c @@ -0,0 +1,304 @@ +/****************************************************************************** + * Copyright © 2016 jl777 * + * ALL RIGHTS RESERVED * + * * + * Removal or modification of this copyright notice is prohibited. * + * * + ******************************************************************************/ + +#ifndef __APPLE__ +#include "../iguana/iguana777.h" +#else +#include "iguana777.h" +#endif + +#define STEEMIT_PLANKTON 0 +#define STEEMIT_MINNOW_BALANCE 100 +#define STEEMIT_MINNOW 1 +#define STEEMIT_DOLPHIN_BALANCE 1000 +#define STEEMIT_DOLPHIN 2 +#define STEEMIT_WHALE_BALANCE 100000 +#define STEEMIT_WHALE 3 +#define STEEMIT_MEGAWHALE_BALANCE 1000000 +#define STEEMIT_MEGAWHALE 4 + +#include "postingkeys.c" +#define rand_account() postingkeys[rand() % (sizeof(postingkeys)/sizeof(*postingkeys))][0] + +struct vote_totals { char name[16]; uint32_t whale,nonwhale,whale_for_whale,whale_for_nonwhale,nonwhale_for_whale,nonwhale_for_nonwhale,whale_selfvote,nonwhale_selfvote; }; +struct steemit_word { UT_hash_handle hh; int score,ind; char wordpair[]; }; +struct steemit_vote { UT_hash_handle hh; double payout; char permlink[]; }; +struct steemit_whale { UT_hash_handle hh; double stake; char whale[]; }; +struct steemit_post { UT_hash_handle hh; double author_steempower,tallypower[STEEMIT_MEGAWHALE+1]; uint32_t height,author_type,tally[STEEMIT_MEGAWHALE+1]; char key[]; }; + +void steemit_vote(int32_t height,int32_t ind,int32_t j,cJSON *json); +void steemit_comment(int32_t height,int32_t ind,int32_t j,cJSON *json,int32_t activeflag); + +struct upvote_info +{ + char upvoter[64],*author,*permlink,*voters[1000]; + int32_t numvoters,whaleids[1000]; double weights[1000]; uint32_t starttime; +}; + +#define issue_IGUANA(url) bitcoind_RPC(0,"curl",url,0,0,0) +void *curl_post(void **cHandlep,char *url,char *userpass,char *postfields,char *hdr0,char *hdr1,char *hdr2,char *hdr3); +int32_t USE_JAY,Startheight; + +char *STEEM_getstate(char *category) +{ + static void *cHandle; + char params[1024],url[512],*retstr; + if ( category == 0 ) + category = ""; + sprintf(url,"http://127.0.0.1:8090"); + sprintf(params,"{\"id\":%llu,\"method\":\"call\",\"params\":[\"database_api\", \"get_state\", [\"%s\"]]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),category); + retstr = curl_post(&cHandle,url,"",params,0,0,0,0); + return(retstr); +} + +char *STEEM_getblock(int32_t height) +{ + static void *cHandle; + char params[1024],url[512],*retstr; + sprintf(url,"http://127.0.0.1:8090"); + sprintf(params,"{\"id\":%llu,\"method\":\"call\",\"params\":[\"database_api\", \"get_block\", [%d]]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),height); + retstr = curl_post(&cHandle,url,"",params,0,0,0,0); + return(retstr); +} + +char *STEEM_vote(char *voter,char *author,char *permalink,int8_t wt,int32_t forceflag) +{ + static void *cHandle; static portable_mutex_t mutex; + char params[1024],url[512],*retstr; + if ( cHandle == 0 ) + portable_mutex_init(&mutex); + if ( strcmp(voter,"jl777") != 0 && strcmp(voter,"taker") != 0 && strcmp(voter,"karen13") != 0 && strcmp(voter,"proto") != 0 && strcmp(voter,"yefet") != 0 ) + { + printf("OVERRIDE: only jl777 upvotes %s.(%s %s)\n",voter,author,permalink); + return(clonestr("{\"error\":\"override and dont vote\"}")); + } + if ( forceflag == 0 && strncmp(permalink,"re-",3) == 0 )//&& (strcmp(voter,"jl777") == 0 || strcmp(voter,"taker") == 0) ) + { + printf("OVERRIDE: no upvoting on comments.(%s %s)\n",author,permalink); + return(clonestr("{\"error\":\"override and dont vote\"}")); + } + portable_mutex_lock(&mutex); + if ( wt > 100 ) + wt = 100; + else if ( wt < -100 ) + wt = -100; + sprintf(url,"http://127.0.0.1:8091"); + sprintf(params,"{\"id\":%llu,\"method\":\"vote\",\"params\":[\"%s\", \"%s\", \"%s\", %d, true]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),voter,author,permalink,wt); + retstr = curl_post(&cHandle,url,"",params,0,0,0,0); + portable_mutex_unlock(&mutex); + return(retstr); +} + +char *STEEM_getcontent(char *author,char *permalink) +{ + static void *cHandle; + char params[1024],url[512],*retstr; + sprintf(url,"http://127.0.0.1:8090"); + sprintf(params,"{\"id\":%llu,\"method\":\"get_content\",\"params\":[\"%s\", \"%s\"]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),author,permalink); + //printf("(%s %s) -> (%s)\n",author,permalink,params); + retstr = curl_post(&cHandle,url,"",params,0,0,0,0); + return(retstr); +} + +char *STEEM_getcomments(char *author,char *permalink) +{ + static void *cHandle; + char params[1024],url[512],*retstr; + sprintf(url,"http://127.0.0.1:8090"); + sprintf(params,"{\"id\":%llu,\"method\":\"get_content_replies\",\"params\":[\"%s\", \"%s\"]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),author,permalink); + //printf("(%s %s) -> (%s)\n",author,permalink,params); + retstr = curl_post(&cHandle,url,"",params,0,0,0,0); + return(retstr); +} + +char *STEEM_accountinfo(char *author) +{ + static void *cHandle; + char params[1024],url[512],*retstr; + sprintf(url,"http://127.0.0.1:8091"); + sprintf(params,"{\"id\":%llu,\"method\":\"get_account\",\"params\":[\"%s\"]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),author); + retstr = curl_post(&cHandle,url,"",params,0,0,0,0); + return(retstr); +} + +int32_t permalink_str(char *permalink,int32_t size,char *str) +{ + int32_t i,c; + for (i=0; str[i]!=0 && i= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') ) + { + + } else c = '-'; + permalink[i] = tolower(c); + } + permalink[i] = 0; + return(i); +} + +char *STEEM_comment(char *author,char *usepermalink,char *parent,char *parentpermalink,char *title,char *body,char *tag) +{ + /*post_comment(string author, string permlink, string parent_author, string parent_permlink, string title, string body, string json, bool broadcast) + "parent_author": "", + "parent_permlink": "introduceyourself", + "author": "jl777", + "permlink": "steemit-is-crypto-s-first-mass-market-solution", + "title": "steemit is crypto's first mass market solution!", + "body": "test post" + "json_metadata": "{\"tags\":[\"introduceyourself\",\"blockchain\",\"bitcoin\",\"networking\",\"iguana\",\"supernet\",\"bitcoindark\",\"\"],\"links\":[\"https://bitco.in/forum/forums/iguana.23/\"]}" + curl --url "http://127.0.0.1:8091" --data "{\"id\":444,\"method\":\"post_comment\",\"params\":[\"taker\", \"test-title\", \"\", \"introduceyourself\", \"test title\", \"test body\", \"{\\\"tags\\\":[\\\"introduceyourself\\\", \\\"test\\\", \\\"\\\"]}\", true]}"*/ + static void *cHandle; + char *params,permalink[4096],url[512],*retstr; + params = malloc(1024*1024*10); + if ( parent != 0 && parent[0] != 0 && strlen(parentpermalink)+strlen(parent)+8 < sizeof(permalink) ) + { + if ( usepermalink != 0 ) + strcpy(permalink,usepermalink); + else sprintf(permalink,"re-%s-%s-r%d",parent,parentpermalink,rand() & 0x7fffffff); + } + else permalink_str(permalink,sizeof(permalink),title); + sprintf(url,"http://127.0.0.1:8091"); + if ( tag != 0 ) + sprintf(params,"{\"id\":%llu,\"method\":\"post_comment\",\"params\":[\"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"{\\\"tags\\\":[\\\"%s\\\", \\\"steem\\\", \\\"steemit\\\", \\\"test\\\", \\\"\\\"]}\", true]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),author,permalink,parent,parentpermalink,title,body,tag); //\\\"introduceyourself\\\", + else sprintf(params,"{\"id\":%llu,\"method\":\"post_comment\",\"params\":[\"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"{}\", true]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),author,permalink,parent,parentpermalink,title,body); + //printf("ABOUT TO POST.(%s)\n",params), getchar(); + retstr = curl_post(&cHandle,url,"",params,0,0,0,0); + free(params); + //printf("got.(%s)\n",retstr); + return(retstr); +} + +char *STEEM_post(char *author,char *title,char *body,char *tag) +{ + return(STEEM_comment(author,0,"",tag!=0?tag:"steemit",title,body,tag)); +} + +char *STEEM_gethistory(char *account,int32_t firsti,int32_t num) +{ + static void *cHandle; + char params[1024],url[512],*retstr; + sprintf(url,"http://127.0.0.1:8090"); + sprintf(params,"{\"id\":%llu,\"method\":\"get_account_history\",\"params\":[\"%s\", %d, %d]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),account,firsti,num); + retstr = curl_post(&cHandle,url,"",params,0,0,0,0); + //printf("(%s) -> (%s)\n",params,retstr); + return(retstr); +} + +char *IGUANA_request(char *agent,char *method,cJSON *argjson) +{ + static void *cHandle; + char *argstr=0,*retstr,url[512]; + if ( argjson != 0 ) + argstr = jprint(argjson,0); + sprintf(url,"http://127.0.0.1:7778/api/%s/%s",agent,method); + retstr = curl_post(&cHandle,url,"",argstr,0,0,0,0); + if ( argstr != 0 ) + free(argstr); + return(retstr); +} + +int32_t special_account(char *account) +{ + int32_t i; + if ( strcmp("jl777",account) == 0 || strcmp("upvotes",account) == 0 || strcmp("taker",account) == 0 ) + return(1); + for (i=0; i (%s)\n",author,permlink,retstr); + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + if ( (result= jobj(retjson,"result")) != 0 ) + { + safecopy(author,jstr(result,"parent_author"),sizeof(author)); + safecopy(permlink,jstr(result,"parent_permlink"),sizeof(permlink)); + if ( author[0] != 0 ) + { + strcpy(_author,author); + strcpy(_permlink,permlink); + } + } else author[0] = 0; + free_json(retjson); + } + free(retstr); + } + } + return(depth); +} + +int32_t steemit_body(char *buf,int32_t size,char *author,char *permlink) +{ + char *retstr,*body; cJSON *retjson,*result; int32_t len = 0; + if ( (retstr= STEEM_getcomments(author,permlink)) != 0 ) + { + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + if ( (result= jobj(retjson,"result")) != 0 ) + { + if ( (body= jstr(result,"body")) != 0 ) + { + if ( (len= (int32_t)strlen(body)) > size ) + len = size; + strncpy(buf,body,len); + } + } + free_json(retjson); + } + free(retstr); + } + return(len); +} + +int32_t steemit_power(double *powerp,char *author) +{ + char *retstr; cJSON *retjson,*result; double steempower; int32_t retval = 0; + *powerp = 0.; + if ( (retstr= STEEM_accountinfo(author)) != 0 ) + { + //printf("power.(%s)\n",retstr); + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + if ( (result= jobj(retjson,"result")) != 0 ) + { + *powerp = steempower = jdouble(result,"vesting_shares") * .001; + if ( steempower >= STEEMIT_MINNOW_BALANCE ) + { + if ( steempower >= STEEMIT_DOLPHIN_BALANCE ) + { + if ( steempower >= STEEMIT_WHALE_BALANCE ) + { + if ( steempower >= STEEMIT_MEGAWHALE_BALANCE ) + retval = STEEMIT_MEGAWHALE; + else retval = STEEMIT_WHALE; + } else retval = STEEMIT_DOLPHIN; + } else retval = STEEMIT_MINNOW; + } else retval = STEEMIT_PLANKTON; + //printf("%s type.%d %.3f\n",author,retval,steempower); + } else printf("(%s) -> no result.(%s)\n",author,retstr); + free_json(retjson); + } + free(retstr); + } + return(retval); +} diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 9c474c471..e8955e412 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -123,7 +123,7 @@ void dex_reqsend(struct supernet_info *myinfo,uint8_t *data,int32_t datalen) nn_freemsg(retptr); } free(dexp); - printf("DEXREQ.[%d] crc32.%08x datalen.%d sent.%d\n",size,dexp->crc32,datalen,sentbytes); + //printf("DEXREQ.[%d] crc32.%08x datalen.%d sent.%d\n",size,dexp->crc32,datalen,sentbytes); } } diff --git a/iguana/iguana_bitmap.c b/iguana/iguana_bitmap.c index 25413848f..94a63fc72 100755 --- a/iguana/iguana_bitmap.c +++ b/iguana/iguana_bitmap.c @@ -116,6 +116,7 @@ void gen_ppmfile(char *fname,int32_t binaryflag,uint8_t *bitmap,int32_t width,in void gen_jpegfile(char *fname,int32_t quality,uint8_t *bitmap,int32_t width,int32_t height) { +#ifdef later struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; FILE * outfile; /* target file */ @@ -145,6 +146,7 @@ void gen_jpegfile(char *fname,int32_t quality,uint8_t *bitmap,int32_t width,int3 jpeg_finish_compress(&cinfo); fclose(outfile); jpeg_destroy_compress(&cinfo); +#endif } /* diff --git a/iguana/steemit_parser.c b/iguana/steemit_parser.c new file mode 100644 index 000000000..d3ddb74bd --- /dev/null +++ b/iguana/steemit_parser.c @@ -0,0 +1,384 @@ +/****************************************************************************** + * Copyright © 2016 jl777 * + * ALL RIGHTS RESERVED * + * * + * Removal or modification of this copyright notice is prohibited. * + * * + ******************************************************************************/ + +int32_t init_startheight(int32_t startheight) +{ + long filesize; int32_t height; char *heightstr; + if ( (heightstr= OS_filestr(&filesize,TRADEBOT_NAME)) != 0 ) + { + height = atoi(heightstr); + free(heightstr); + if ( height > 0 && height < startheight ) + startheight = height; + } + return(startheight); +} + +void steemit_history_limitorder(int32_t ind,char *acount,cJSON *opitem) +{ + // hwm.12081 flag.1 limit_order_create ({"owner":"taker","orderid":1469136578,"amount_to_sell":"24.346 SBD","min_to_receive":"7.770 STEEM","fill_or_kill":false,"expiration":"2016-07-24T23:21:24"}) +} + +void steemit_update_inventory(double *SBD,double *SBDVOL,double *STEEMVOL,double *STEEM,double myvol,char *mycoin,char *other,double othervol,char *othercoin) +{ + if ( strcmp(mycoin,"SBD") == 0 && strcmp(othercoin,"STEEM") == 0 ) + { + *SBD -= myvol; + *SBDVOL += myvol; + *STEEM += othervol; + *STEEMVOL += othervol; + } + else if ( strcmp(mycoin,"STEEM") == 0 && strcmp(othercoin,"SBD") == 0 ) + { + *STEEM -= myvol; + *STEEMVOL += myvol; + *SBD += othervol; + *SBDVOL += othervol; + } else printf("steemit_update_inventory: unexpected pair (%s) (%s)\n",mycoin,othercoin); +} + +void steemit_history_fillorder(int32_t ind,char *account,cJSON *opitem) +{ + static double SBD,STEEM,SBDVOL,STEEMVOL; + char *taker,*maker,*takercoin,*makercoin; uint64_t openorderid,fillorderid; double takervol,makervol; + taker = jstr(opitem,"current_owner"); + fillorderid = j64bits(opitem,"current_orderid"); + takercoin = jstr(opitem,"current_pays"); + maker = jstr(opitem,"open_owner"); + openorderid = j64bits(opitem,"open_orderid"); + makercoin = jstr(opitem,"open_pays"); + if ( taker != 0 && maker != 0 && takercoin != 0 && makercoin != 0 && (strcmp(account,taker) == 0 || strcmp(maker,account) == 0) ) + { + takervol = atof(takercoin); + while ( *takercoin != 0 && *takercoin != ' ' ) + takercoin++; + makervol = atof(makercoin); + while ( *makercoin != 0 && *makercoin != ' ' ) + makercoin++; + if ( strcmp(taker,account) == 0 ) + { + steemit_update_inventory(&SBD,&SBDVOL,&STEEMVOL,&STEEM,takervol,takercoin+1,maker,makervol,makercoin+1); + printf("%6d %s.(%.6f%s) <-> %s.(%.6f%s) SBD %.6f STEEM %.6f | VOL SBD %.6f STEEM %.6f-> %.6f\n",ind,taker,takervol,takercoin,maker,makervol,makercoin,SBD,STEEM,SBDVOL,STEEMVOL,SBD/STEEM); + } + else + { + steemit_update_inventory(&SBD,&SBDVOL,&STEEMVOL,&STEEM,takervol,takercoin+1,maker,makervol,makercoin+1); + printf("%6d %s.(%.6f%s) <-> %s.(%.6f%s) SBD %.6f STEEM %.6f | VOL SBD %.6f STEEM %.6f-> %.6f\n",ind,maker,makervol,makercoin,taker,takervol,takercoin,SBD,STEEM,SBDVOL,STEEMVOL,SBD/STEEM); + } + } + //hwm.12077 flag.1 fill_order ({"current_owner":"enki","current_orderid":3402053187,"current_pays":"19.613 SBD","open_owner":"taker","open_orderid":1469136521,"open_pays":"5.792 STEEM"}) + +} + +void steemit_tradehistory(char *account) +{ + int32_t j,n,m,ind,flag = 1,hwm = 0; cJSON *retjson,*result,*item,*oparray,*opitem; char *opstr,*retstr; + while ( flag != 0 ) + { + flag = 0; + if ( (retstr= STEEM_gethistory(account,hwm+1,1)) != 0 ) + { + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + if ( (result= jarray(&n,retjson,"result")) != 0 ) + { + for (j=0; j %s",key,fname); + system(cmd); + if ( (str2= OS_filestr(&filesize,fname)) != 0 ) + { + if ( (json2= cJSON_Parse(str2)) != 0 ) + { + if ( (postingkey= jstr(json2,"result")) != 0 ) + { + //miner = ["supernet", "5J4gTpk4CMBdPzgaRj7yNXDZTzBBQ41bNyJTqHbBi7Ku6v75bXa"] + //fprintf(postingkeys,"miner = [\"%s\", \"%s\"]\n",name,postingkey); + fprintf(postingkeys,"witness = \"%s\"\n",name); + //fprintf(postingkeys,"{ \"%s\", \"%s\" },",name,postingkey); + } + else printf("no result in (%s)\n",jprint(json2,0)); + free_json(json2); + } else printf("couldnt parse (%s)\n",str2); + free(str2); + } else printf("couldnt load (%s)\n",fname); + } + } + } + } + fprintf(postingkeys,"\n};\n"); + fclose(postingkeys); + } + free_json(json); + } + free(str); + } +} + +void tradebots_LP(char *configjsonstr,char *arg) +{ + char *retstr,*cmdstr; int32_t i,tallymode=0,repeat,lastheight=0,j,n,one,height = -1; cJSON *obj,*json,*operations,*item,*retjson,*result,*props,*transactions; + if ( configjsonstr != 0 && (json= cJSON_Parse(configjsonstr)) != 0 ) + { + // process config + free_json(json); + } + strcpy(Articles.name,"Articles"); + strcpy(Comments.name,"Comments"); + strcpy(Votes.name,"Votes"); + if ( (retstr= STEEM_getstate(0)) == 0 ) + return; + for (i=0; i= 0 ) + { + if ( tallymode != 0 && height == Startheight ) + { + printf("reached Startheight.%d, getchar()\n",Startheight); + steemit_summary(Startheight); + getchar(); + exit(0); + } + if ( (retstr= STEEM_getblock(height)) != 0 ) + { + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + if ( (result= jobj(retjson,"result")) != 0 ) + { + if ( (transactions= jarray(&n,result,"transactions")) != 0 ) + { + if ( tallymode == 0 ) + printf("lag.%d ht.%d n.%d\n",height-Startheight,height,n); + for (i=0; i= Startheight) && strcmp("comment",cmdstr) == 0 ) + steemit_comment(height,i,j,obj,height >= Startheight); + else if ( height >= Startheight ) + { + if ( strcmp("limit_order_create",cmdstr) == 0 ) + steemit_limitorder(height,i,j,obj); + else if ( strcmp("convert",cmdstr) == 0 ) + steemit_convert(height,i,j,obj); + else if ( strcmp("custom_json",cmdstr) == 0 ) + steemit_customjson(height,i,j,obj); + else if ( strcmp("transfer_to_vesting",cmdstr) == 0 ) + steemit_powerup(height,i,j,obj); + else if ( strcmp("account_update",cmdstr) == 0 ) + steemit_accountupdate(height,i,j,obj); + else if ( strcmp("transfer",cmdstr) == 0 ) + steemit_transfer(height,i,j,obj); + else if ( strcmp("limit_order_cancel",cmdstr) == 0 ) + steemit_cancelorder(height,i,j,obj); + else if ( strcmp("delete_comment",cmdstr) == 0 ) + steemit_deletecomment(height,i,j,obj); + else if ( strcmp("pow",cmdstr) == 0 ) + steemit_pow(height,i,j,obj); + else if ( strcmp("feed_publish",cmdstr) == 0 ) + steemit_feedpublish(height,i,j,obj); + else if ( strcmp("withdraw_vesting",cmdstr) == 0 ) + steemit_powerdown(height,i,j,obj); + else if ( strcmp("account_witness_vote",cmdstr) == 0 ) + steemit_accountwitness(height,i,j,obj); + else printf("%d.%d.%d: %s.(%s)\n",height,i,j,cmdstr,jprint(obj,0)); + } + } else printf("%d.%d: unexpected paired item.(%s)\n",height,i,jprint(item,0)); + } else printf("%d.%d: unexpected unpaired item.(%s)\n",height,i,jprint(item,0)); + } + } + } + } else if ( is_cJSON_Null(result) == 0 && jstr(result,"previous") == 0 ) + printf("ht.%d no transactions in result.(%s)\n",height,jprint(result,0)); + if ( is_cJSON_Null(result) == 0 ) + { + FILE *fp; + if ( (fp= fopen(TRADEBOT_NAME,"wb")) != 0 ) + { + // printf("startheight.%d for %s\n",height,TRADEBOT_NAME); + fprintf(fp,"%d\n",height); + fclose(fp); + } else printf("error saving startheight.%d for %s\n",height,TRADEBOT_NAME); + height++, repeat = 0; + if ( 0 && tallymode != 0 && (height % 1000) == 0 ) + disp_vote_totals(height); + } + } else printf("ht.%d no result in (%s)\n",height,jprint(retjson,0)); + //printf("ht.%d blockstr.(%s)\n",height,retstr); + free_json(retjson); + } else printf("ht.%d couldnt parse.(%s)\n",height,retstr); + free(retstr); + } else printf("error getting ht.%d\n",height); + if ( height >= Startheight ) + sleep(1); + if ( height == lastheight && ++repeat > 3 ) + height++, repeat = 0, lastheight = height; +#ifdef __APPLE__ + continue; +#endif + } + printf("done whale watching, hope you enjoyed the show\n"); +} diff --git a/includes/iguana_apideclares.h b/includes/iguana_apideclares.h index fe267a9d5..0bc2c0e5b 100755 --- a/includes/iguana_apideclares.h +++ b/includes/iguana_apideclares.h @@ -64,14 +64,14 @@ HASH_ARRAY_STRING(basilisk,subscribe,hash,vals,hexstr); HASH_ARRAY_STRING(basilisk,forward,hash,vals,hexstr); HASH_ARRAY_STRING(basilisk,mailbox,hash,vals,hexstr); -HASH_ARRAY_STRING(basilisk,VPNcreate,hash,vals,hexstr); +/*HASH_ARRAY_STRING(basilisk,VPNcreate,hash,vals,hexstr); HASH_ARRAY_STRING(basilisk,VPNjoin,hash,vals,hexstr); HASH_ARRAY_STRING(basilisk,VPNmessage,hash,vals,hexstr); HASH_ARRAY_STRING(basilisk,VPNbroadcast,hash,vals,hexstr); HASH_ARRAY_STRING(basilisk,VPNreceive,hash,vals,hexstr); HASH_ARRAY_STRING(basilisk,VPNlogout,hash,vals,hexstr); -HASH_ARRAY_STRING(basilisk,vote,hash,vals,hexstr); +HASH_ARRAY_STRING(basilisk,vote,hash,vals,hexstr);*/ ZERO_ARGS(bitcoinrpc,getinfo); ZERO_ARGS(bitcoinrpc,getblockcount); @@ -208,7 +208,7 @@ TWO_STRINGS(tradebot,stop,exchange,botid); TWO_STRINGS(tradebot,resume,exchange,botid); #ifndef WIN32 -HASH_ARG(pangea,call,tablehash); +/*HASH_ARG(pangea,call,tablehash); HASH_AND_INT(pangea,raise,tablehash,numchips); HASH_AND_INT(pangea,bet,tablehash,numchips); HASH_ARG(pangea,check,tablehash); @@ -222,7 +222,7 @@ INT_AND_ARRAY(pangea,host,minplayers,params); ZERO_ARGS(pangea,lobby); HASH_AND_STRING(pangea,join,tablehash,handle); HASH_AND_INT(pangea,buyin,tablehash,numchips); -HASH_ARG(pangea,start,tablehash); +HASH_ARG(pangea,start,tablehash);*/ #endif ZERO_ARGS(SuperNET,help);