From 081a8d411cdbebf730bab1855bee2f9a93f7ea88 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 14 Feb 2016 06:29:20 -0300 Subject: [PATCH] test --- iguana/exchanges/nxtae.c | 4 ++-- iguana/iguana777.h | 2 +- iguana/main.c | 20 +++++++++++++++++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/nxtae.c b/iguana/exchanges/nxtae.c index 755039045..fe620bc1c 100755 --- a/iguana/exchanges/nxtae.c +++ b/iguana/exchanges/nxtae.c @@ -83,11 +83,11 @@ char *_get_MSoffers(struct supernet_info *myinfo,char *str) return(issue_NXTPOST(cmd)); } -char *issue_startForging(char *url,char *secret) +char *issue_startForging(struct supernet_info *myinfo,char *secret) { char cmd[4096]; sprintf(cmd,"requestType=startForging&secretPhrase=%s",secret); - return(bitcoind_RPC(0,"curl",url,0,0,cmd)); + return(issue_NXTPOST(cmd)); } uint32_t get_blockutime(struct supernet_info *myinfo,uint32_t blocknum) diff --git a/iguana/iguana777.h b/iguana/iguana777.h index 33e704b97..bce46d8fe 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -755,7 +755,7 @@ cJSON *bitcoin_addinput(struct iguana_info *coin,cJSON *txobj,bits256 txid,int32 int32_t bitcoin_verifytx(struct iguana_info *coin,bits256 *signedtxidp,char **signedtx,char *rawtxstr,struct vin_info *V); char *bitcoin_json2hex(struct iguana_info *coin,bits256 *txidp,cJSON *txjson); int32_t bitcoin_addr2rmd160(uint8_t *addrtypep,uint8_t rmd160[20],char *coinaddr); -char *issue_startForging(char *url,char *secret); +char *issue_startForging(struct supernet_info *myinfo,char *secret); extern queue_t bundlesQ; diff --git a/iguana/main.c b/iguana/main.c index f3e5da830..7cc8e2c43 100644 --- a/iguana/main.c +++ b/iguana/main.c @@ -1032,16 +1032,34 @@ void iguana_main(void *arg) { int32_t usessl = 0, ismainnet = 1; struct supernet_info *myinfo; char *tmpstr,*helperargs,*coinargs,helperstr[512]; int32_t i; - issue_startForging("http://127.0.0.1:7876","secret"); mycalloc(0,0,0); myinfo = SuperNET_MYINFO(0); + FILE *fp; int32_t iter; + strcpy(myinfo->NXTAPIURL,"http://127.0.0.1:7876"); + for (iter=0; iter<2; iter++) + { + if ( (fp= fopen(iter == 0 ? "nxtpasswords" : "fimpasswords","rb")) != 0 ) + { + char line[4096],NXTaddr[64]; int32_t j; uint8_t pubkey[32]; + while ( fgets(line,sizeof(line),fp) > 0 ) + { + j = (int32_t)strlen(line) - 1; + line[j] = 0; + calc_NXTaddr(NXTaddr,pubkey,(uint8_t *)line,j); + printf("FORGING %s (%s)\n",NXTaddr,issue_startForging(myinfo,line)); + } + fclose(fp); + } + strcpy(myinfo->NXTAPIURL,"http://127.0.0.1:7886"); + } if ( usessl == 0 ) strcpy(myinfo->NXTAPIURL,"http://127.0.0.1:"); else strcpy(myinfo->NXTAPIURL,"https://127.0.0.1:"); if ( ismainnet != 0 ) strcat(myinfo->NXTAPIURL,"7876/nxt"); else strcat(myinfo->NXTAPIURL,"6876/nxt"); + #ifndef _WIN32 signal(SIGINT,sigint_func); signal(SIGILL,sigillegal_func);