diff --git a/iguana/dPoW.h b/iguana/dPoW.h index 0140584b6..1fa12cb3c 100755 --- a/iguana/dPoW.h +++ b/iguana/dPoW.h @@ -158,6 +158,7 @@ char *dpow_importaddress(struct supernet_info *myinfo,struct iguana_info *coin,c char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address); cJSON *dpow_listunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr); cJSON *dpow_listtransactions(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,int32_t count,int32_t skip); +char *dpow_alladdresses(struct supernet_info *myinfo,struct iguana_info *coin); char *_dex_getinfo(struct supernet_info *myinfo,char *symbol); char *_dex_getrawtransaction(struct supernet_info *myinfo,char *symbol,bits256 txid); @@ -170,5 +171,6 @@ char *_dex_importaddress(struct supernet_info *myinfo,char *symbol,char *address char *_dex_validateaddress(struct supernet_info *myinfo,char *symbol,char *address); char *_dex_listunspent(struct supernet_info *myinfo,char *symbol,char *address); char *_dex_listtransactions(struct supernet_info *myinfo,char *symbol,char *coinaddr,int32_t count,int32_t skip); +char *_dex_alladdresses(struct supernet_info *myinfo,char *symbol); #endif diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index d6db57336..1e69478a0 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -258,6 +258,10 @@ char *dex_response(int32_t *broadcastflagp,struct supernet_info *myinfo,struct d { retstr = dpow_sendrawtransaction(myinfo,coin,(char *)&dexp->packet[datalen]); } + else if ( dexreq.func == '*' ) + { + retstr = dpow_alladdresses(myinfo,coin); + } else if ( dexreq.func == 'L' ) { //printf("call list.(%s %d %d)\n",(char *)&dexp->packet[datalen],dexreq.shortarg,dexreq.intarg); @@ -333,6 +337,15 @@ char *_dex_getinfo(struct supernet_info *myinfo,char *symbol) return(_dex_sendrequest(myinfo,&dexreq)); } +char *_dex_alladdresses(struct supernet_info *myinfo,char *symbol) +{ + struct dex_request dexreq; + memset(&dexreq,0,sizeof(dexreq)); + safecopy(dexreq.name,symbol,sizeof(dexreq.name)); + dexreq.func = '*'; + return(_dex_sendrequest(myinfo,&dexreq)); +} + char *_dex_getblock(struct supernet_info *myinfo,char *symbol,bits256 hash2) { struct dex_request dexreq; diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 7ea3b94b4..b8dc0670b 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -426,13 +426,46 @@ char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *c } } +char *dpow_alladdresses(struct supernet_info *myinfo,struct iguana_info *coin) +{ + char *retstr,fname[1024]; long filesize; + sprintf(fname,"%s/alladdresses.%s",GLOBAL_CONFSDIR,coin->symbol), OS_compatible_path(fname); + retstr = OS_filestr(&filesize,fname); + return(retstr); +} + char *dpow_importaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address) { - char buf[128],*retstr; + char buf[128],*retstr,*alladdresses,*outstr,fname[1024]; cJSON *alljson; int32_t i,n; FILE *fp; if ( coin->FULLNODE < 0 ) { sprintf(buf,"[\"%s\", \"%s\", false]",address,address); retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"importaddress",buf); + if ( (alladdresses= dpow_alladdresses(myinfo,coin)) != 0 ) + { + if ( (alljson= cJSON_Parse(alladdresses)) != 0 ) + { + if ( is_cJSON_Array(alljson) != 0 && (n= cJSON_GetArraySize(alljson)) > 0 ) + { + for (i=0; isymbol), OS_compatible_path(fname); + if ( (fp= fopen(fname,"wb")) != 0 ) + { + fwrite(outstr,1,strlen(outstr)+1,fp); + fclose(fp); + } + free(outstr); + } + } + free_json(alljson); + } + } return(retstr); } else return(0); diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 625ed2942..3787ef58f 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -539,6 +539,11 @@ STRING_ARG(dex,getbestblockhash,symbol) return(_dex_getbestblockhash(myinfo,symbol)); } +STRING_ARG(dex,alladdresses,symbol) +{ + return(_dex_alladdresses(myinfo,symbol)); +} + STRING_AND_INT(dex,getblockhash,symbol,height) { return(_dex_getblockhash(myinfo,symbol,height)); diff --git a/includes/iguana_apideclares.h b/includes/iguana_apideclares.h index 21cf47bd3..fc5bc5e6c 100755 --- a/includes/iguana_apideclares.h +++ b/includes/iguana_apideclares.h @@ -23,6 +23,7 @@ STRING_ARG(dpow,bindaddr,ipaddr); TWO_STRINGS(dex,send,hex,handler); HASH_AND_STRING(dex,gettransaction,txid,symbol); STRING_ARG(dex,getinfo,symbol); +STRING_ARG(dex,alladdresses,symbol); STRING_ARG(dex,getbestblockhash,symbol); STRING_AND_INT(dex,getblockhash,symbol,height); HASH_AND_STRING(dex,getblock,hash,symbol);