diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index e024dfd35..f5d1818b1 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -862,47 +862,6 @@ int32_t basilisk_issued_purge(struct supernet_info *myinfo,int32_t timepad) return(n); } -/*#define issue_curl2(cmdstr) bitcoind_RPC(0,(char *)"curl",(char *)"http://127.0.0.1:7778",0,0,(char *)(cmdstr)) - -void komodo_iteration(char *symbol) -{ - char *retstr,*base,*coinaddr,*txidstr,cmd[512]; uint64_t value,fiatoshis; cJSON *array,*item; int32_t i,n,vout,shortflag,height,fiatheight; bits256 txid; uint8_t rmd160[20],addrtype; - //if ( ASSETCHAINS_SYMBOL[0] == 0 ) - { - sprintf(cmd,"{\"agent\":\"dpow\",\"method\":\"pending\",\"fiat\":\"%s\"}",symbol); - if ( (retstr= issue_curl2(cmd)) != 0 ) - { - if ( (array= cJSON_Parse(retstr)) != 0 ) - { - if ( (n= cJSON_GetArraySize(array)) > 0 ) - { - for (i=0; i 0 && height > 0 ) - { - fiatoshis = jdouble(item,base) * SATOSHIDEN; - decode_hex((uint8_t *)&txid,sizeof(txid),txidstr); - bitcoin_addr2rmd160(&addrtype,rmd160,coinaddr); - //komodo_gateway_deposit(coinaddr,value,shortflag,base,fiatoshis,rmd160,txid,vout,height,fiatheight); - } - } - } - } - printf("retstr.(%s)\n",retstr); - free(retstr); - } - } -}*/ - void basilisks_loop(void *arg) { static uint32_t counter; diff --git a/deprecated/obsolete.h b/deprecated/obsolete.h index a3738137d..e9c6eb4b6 100755 --- a/deprecated/obsolete.h +++ b/deprecated/obsolete.h @@ -20197,4 +20197,106 @@ len = 0; } if ( Minerfp != 0 && fread(Minerids,1,sizeof(Minerids),Minerfp) != sizeof(Minerids) ) printf("read error Minerids\n");*/ - + /*#define issue_curl2(cmdstr) bitcoind_RPC(0,(char *)"curl",(char *)"http://127.0.0.1:7778",0,0,(char *)(cmdstr)) + + void komodo_iteration(char *symbol) + { + char *retstr,*base,*coinaddr,*txidstr,cmd[512]; uint64_t value,fiatoshis; cJSON *array,*item; int32_t i,n,vout,shortflag,height,fiatheight; bits256 txid; uint8_t rmd160[20],addrtype; + //if ( ASSETCHAINS_SYMBOL[0] == 0 ) + { + sprintf(cmd,"{\"agent\":\"dpow\",\"method\":\"pending\",\"fiat\":\"%s\"}",symbol); + if ( (retstr= issue_curl2(cmd)) != 0 ) + { + if ( (array= cJSON_Parse(retstr)) != 0 ) + { + if ( (n= cJSON_GetArraySize(array)) > 0 ) + { + for (i=0; i 0 && height > 0 ) + { + fiatoshis = jdouble(item,base) * SATOSHIDEN; + decode_hex((uint8_t *)&txid,sizeof(txid),txidstr); + bitcoin_addr2rmd160(&addrtype,rmd160,coinaddr); + //komodo_gateway_deposit(coinaddr,value,shortflag,base,fiatoshis,rmd160,txid,vout,height,fiatheight); + } + } + } + } + printf("retstr.(%s)\n",retstr); + free(retstr); + } + } + }*/ + /*void komodo_nutxoadd(int32_t height,int32_t notaryid,uint256 txhash,uint64_t voutmask,int32_t numvouts) + { + struct nutxo_entry *np; + if ( numvouts > 1 && notaryid < 64 ) + { + pthread_mutex_lock(&komodo_mutex); + np = (struct nutxo_entry *)calloc(1,sizeof(*np)); + np->height = height; + np->txhash = txhash; + np->voutmask = voutmask; + np->notaryid = notaryid; + HASH_ADD_KEYPTR(hh,NUTXOS,&np->txhash,sizeof(np->txhash),np); + //printf("Add NUTXO[%d] <- %s notaryid.%d t%u %s %llx\n",Num_nutxos,Notaries[notaryid][0],notaryid,komodo_txtime(txhash),txhash.ToString().c_str(),(long long)voutmask); + Num_nutxos++; + pthread_mutex_unlock(&komodo_mutex); + } + } + + int32_t komodo_nutxofind(int32_t height,uint256 txhash,int32_t vout) + { + struct nutxo_entry *np; + pthread_mutex_lock(&komodo_mutex); + HASH_FIND(hh,NUTXOS,&txhash,sizeof(txhash),np); + pthread_mutex_unlock(&komodo_mutex); + if ( np != 0 && ((1LL << vout) & np->voutmask) != 0 ) + return(np->notaryid); + return(-1); + }*/ + + /*void komodo_eventadd_utxo(struct komodo_state *sp,char *symbol,int32_t height,uint8_t notaryid,uint256 txid,uint64_t voutmask,uint8_t numvouts) + { + struct komodo_event_utxo U; + memset(&U,0,sizeof(U)); + U.txid = txid; + U.voutmask = voutmask; + U.numvouts = numvouts; + komodo_eventadd(height,symbol,KOMODO_EVENT_UTXO,(uint8_t *)&U,sizeof(U)); + if ( sp != 0 ) + komodo_nutxoadd(height,notaryid,txid,voutmask,numvouts); + }*/ + /*if ( didinit == 0 ) + { + for (baseid=0; baseid<=32; baseid++) + komodo_userpass(userpass[baseid],CURRENCIES[baseid]); + didinit = 1; + }*/ + /*if ( (retstr= komodo_issuemethod(userpass[baseid],(char *)"getinfo",0,port)) != 0 ) + { + if ( (infoobj= cJSON_Parse(retstr)) != 0 ) + { + if ( (result= jobj(infoobj,(char *)"result")) != 0 ) + { + blocks = juint(result,(char *)"blocks"); + longest = juint(result,(char *)"longestchain"); + //printf("%s.(%d L%d) ",base,blocks,longest); + if ( blocks > 0 && blocks == longest ) + isrealtime = 1; + } + free_json(infoobj); + } + else printf("[%s] %s (%s)\n",ASSETCHAINS_SYMBOL,base,retstr); + free(retstr); + } // else printf("%s port.%u no getinfo\n",base,port);*/ diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 642475160..ae2c7e237 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -742,7 +742,7 @@ uint32_t komodo_assetmagic(char *symbol,uint64_t supply) return(calc_crc32(0,buf,len)); } -int32_t komodo_shortflag(char *symbol) +/*int32_t komodo_shortflag(char *symbol) { int32_t i,shortflag = 0; if ( symbol[0] == '-' ) @@ -753,18 +753,17 @@ int32_t komodo_shortflag(char *symbol) symbol[i] = 0; } return(shortflag); -} +}*/ -uint16_t komodo_assetport(uint32_t magic,int32_t shortflag) +uint16_t komodo_assetport(uint32_t magic) { - return(8000 + shortflag*7777 + (magic % 7777)); + return(8000 + (magic % 7777)); } -uint16_t komodo_port(char *symbol,uint64_t supply,uint32_t *magicp,int32_t *shortflagp) +uint16_t komodo_port(char *symbol,uint64_t supply,uint32_t *magicp) { *magicp = komodo_assetmagic(symbol,supply); - *shortflagp = komodo_shortflag(symbol); - return(komodo_assetport(*magicp,*shortflagp)); + return(komodo_assetport(*magicp)); } #define MAX_CURRENCIES 32 @@ -773,7 +772,7 @@ extern char CURRENCIES[][8]; void komodo_assetcoins() { uint16_t extract_userpass(char *serverport,char *userpass,char *coinstr,char *userhome,char *coindir,char *confname); - int32_t i,j,shortflag; uint32_t magic; cJSON *json; uint16_t port; long filesize; char *userhome,confstr[16],jsonstr[512],magicstr[9],path[512]; struct iguana_info *coin; + int32_t i,j; uint32_t magic; cJSON *json; uint16_t port; long filesize; char *userhome,confstr[16],jsonstr[512],magicstr[9],path[512]; struct iguana_info *coin; if ( (userhome= OS_filestr(&filesize,"userhome.txt")) == 0 ) userhome = "root"; else @@ -783,7 +782,7 @@ void komodo_assetcoins() } for (i=0; iSHORTFLAG ) + if ( shortflag == 0 ) { - if ( shortflag == 0 ) + if ( seed == 0 || checktoshis >= komodoshis ) { - if ( seed == 0 || checktoshis >= komodoshis ) - { - if ( dpow_paxfind(dp,&space,txid,vout) == 0 ) - dpow_issuer_withdraw(dp,coinaddr,fiatoshis,shortflag,base,komodoshis,rmd160,txid,vout,kmdheight,height); - } + if ( dpow_paxfind(dp,&space,txid,vout) == 0 ) + dpow_issuer_withdraw(dp,coinaddr,fiatoshis,shortflag,base,komodoshis,rmd160,txid,vout,kmdheight,height); } - else // short + } + else // short + { + printf("shorting not yet, wait for pax2\n"); + /*for (i=0; isymbol,height); memset(&zero,0,sizeof(zero)); - komodo_stateupdate(height,0,0,0,zero,0,0,0,0,height,0,0,0,0); + komodo_stateupdate(height,0,0,0,zero,0,0,0,0,height,0,0,0,0,0); }*/ if ( dpow_issuer_block(dp,coin,height,port) < 0 ) { diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index ca23d59d2..daff17241 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -347,6 +347,7 @@ STRING_ARG(iguana,addnotary,ipaddr) STRING_ARG(dpow,active,maskhex) { uint8_t data[8],revdata[8]; int32_t i,len; uint64_t mask; cJSON *retjson,*array = cJSON_CreateArray(); + return(clonestr("{\"error\":\"dpow active is deprecated for now\"}")); if ( maskhex == 0 || maskhex[0] == 0 ) { mask = myinfo->DPOWS[0].lastrecvmask;