diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index 5e697c9fb..5400358af 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -857,3 +857,94 @@ void basilisks_init(struct supernet_info *myinfo) portable_mutex_init(&myinfo->messagemutex); myinfo->basilisks.launched = iguana_launch(iguana_coinfind("BTCD"),"basilisks_loop",basilisks_loop,myinfo,IGUANA_PERMTHREAD); } + +#include "../includes/iguana_apidefs.h" +#include "../includes/iguana_apideclares.h" +HASH_ARRAY_STRING(basilisk,balances,hash,vals,hexstr) +{ + char *retstr=0,*symbol; uint32_t basilisktag; struct basilisk_item *ptr,Lptr; int32_t timeoutmillis; + if ( vals == 0 ) + return(clonestr("{\"error\":\"need vals object\"}")); + //if ( coin == 0 ) + { + if ( (symbol= jstr(vals,"symbol")) != 0 || (symbol= jstr(vals,"coin")) != 0 ) + coin = iguana_coinfind(symbol); + } + if ( jobj(vals,"fanout") == 0 ) + jaddnum(vals,"fanout",8); + if ( jobj(vals,"numrequired") == 0 ) + jaddnum(vals,"numrequired",myinfo->numrelays); + if ( coin != 0 ) + { + if ( jobj(vals,"addresses") == 0 ) + { + jadd(vals,"addresses",iguana_getaddressesbyaccount(myinfo,coin,"*")); + printf("added all addresses: %s\n",jprint(vals,0)); + } //else printf("have addresses.(%s)\n",jprint(jobj(vals,"addresses"),0)); + if ( (basilisktag= juint(vals,"basilisktag")) == 0 ) + basilisktag = rand(); + if ( (timeoutmillis= juint(vals,"timeout")) <= 0 ) + timeoutmillis = BASILISK_TIMEOUT; + if ( (coin->RELAYNODE != 0 || coin->VALIDATENODE != 0) && (ptr= basilisk_bitcoinbalances(&Lptr,myinfo,coin,remoteaddr,basilisktag,timeoutmillis,vals)) != 0 ) + { + retstr = ptr->retstr, ptr->retstr = 0; + ptr->finished = (uint32_t)time(NULL); + return(retstr); + } + } else printf("no coin\n"); + return(basilisk_standardservice("BAL",myinfo,0,hash,vals,hexstr,1)); +} + +HASH_ARRAY_STRING(basilisk,history,hash,vals,hexstr) +{ + struct basilisk_unspent *bu; int32_t i; int64_t totalspent=0,total = 0; struct iguana_waccount *wacct,*tmp; struct iguana_waddress *waddr,*tmp2; char *symbol; cJSON *retjson,*array; struct basilisk_spend *s; + if ( vals == 0 ) + return(clonestr("{\"error\":\"need vals object\"}")); + //if ( coin == 0 ) + { + if ( (symbol= jstr(vals,"symbol")) != 0 || (symbol= jstr(vals,"coin")) != 0 ) + coin = iguana_coinfind(symbol); + } + if ( coin == 0 ) + return(clonestr("{\"error\":\"couldnt find coin\"}")); + //printf("history for (%s)\n",coin->symbol); + basilisk_unspents_update(myinfo,coin); + array = cJSON_CreateArray(); + portable_mutex_lock(&myinfo->bu_mutex); + HASH_ITER(hh,myinfo->wallet,wacct,tmp) + { + HASH_ITER(hh,wacct->waddr,waddr,tmp2) + { + for (i=0; inumunspents; i++) + { + bu = &waddr->unspents[i]; + if ( strcmp(bu->symbol,coin->symbol) == 0 ) + { + bitcoin_address(waddr->coinaddr,coin->chain->pubtype,waddr->rmd160,sizeof(waddr->rmd160)); + jaddi(array,basilisk_history_item(coin,&total,waddr->coinaddr,bu->value,bu->timestamp,bu->txid,"vout",bu->vout,bu->height,"spentheight",bu->spentheight,bu->relaymask,-1)); + //printf("%s %s i.%d numunspents.%d\n",coin->symbol,waddr->coinaddr,i,waddr->numunspents); + } + } + } + } + if ( myinfo->numspends > 0 ) + { + //spends = cJSON_CreateArray(); + for (i=0; inumspends; i++) + { + s = &myinfo->spends[i]; + //struct basilisk_spend { bits256 txid; uint64_t relaymask,value; uint32_t timestamp; int32_t vini,height,unspentheight,ismine; char destaddr[64]; }; + if ( strcmp(s->symbol,coin->symbol) == 0 ) + jaddi(array,basilisk_history_item(coin,&totalspent,s->destaddr,s->value,s->timestamp,s->txid,"vin",s->vini,s->height,"unspentheight",s->unspentheight,s->relaymask,s->ismine)); + } + } + portable_mutex_unlock(&myinfo->bu_mutex); + retjson = cJSON_CreateObject(); + jaddstr(retjson,"result","success"); + jadd(retjson,"history",array); + jaddstr(retjson,"coin",coin->symbol); + jaddnum(retjson,"balance",dstr(total)); + return(jprint(retjson,1)); +} + +#include "../includes/iguana_apiundefs.h" diff --git a/basilisk/basilisk_bitcoin.c b/basilisk/basilisk_bitcoin.c index b9a0876e1..f1d684084 100755 --- a/basilisk/basilisk_bitcoin.c +++ b/basilisk/basilisk_bitcoin.c @@ -861,41 +861,6 @@ HASH_ARRAY_STRING(basilisk,value,hash,vals,hexstr) return(retstr); }*/ -HASH_ARRAY_STRING(basilisk,balances,hash,vals,hexstr) -{ - char *retstr=0,*symbol; uint32_t basilisktag; struct basilisk_item *ptr,Lptr; int32_t timeoutmillis; - if ( vals == 0 ) - return(clonestr("{\"error\":\"need vals object\"}")); - //if ( coin == 0 ) - { - if ( (symbol= jstr(vals,"symbol")) != 0 || (symbol= jstr(vals,"coin")) != 0 ) - coin = iguana_coinfind(symbol); - } - if ( jobj(vals,"fanout") == 0 ) - jaddnum(vals,"fanout",8); - if ( jobj(vals,"numrequired") == 0 ) - jaddnum(vals,"numrequired",myinfo->numrelays); - if ( coin != 0 ) - { - if ( jobj(vals,"addresses") == 0 ) - { - jadd(vals,"addresses",iguana_getaddressesbyaccount(myinfo,coin,"*")); - //printf("added all addresses: %s\n",jprint(vals,0)); - } //else printf("have addresses.(%s)\n",jprint(jobj(vals,"addresses"),0)); - if ( (basilisktag= juint(vals,"basilisktag")) == 0 ) - basilisktag = rand(); - if ( (timeoutmillis= juint(vals,"timeout")) <= 0 ) - timeoutmillis = BASILISK_TIMEOUT; - if ( (coin->RELAYNODE != 0 || coin->VALIDATENODE != 0) && (ptr= basilisk_bitcoinbalances(&Lptr,myinfo,coin,remoteaddr,basilisktag,timeoutmillis,vals)) != 0 ) - { - retstr = ptr->retstr, ptr->retstr = 0; - ptr->finished = (uint32_t)time(NULL); - return(retstr); - } - } else printf("no coin\n"); - return(basilisk_standardservice("BAL",myinfo,0,hash,vals,hexstr,1)); -} - cJSON *basilisk_history_item(struct iguana_info *coin,int64_t *totalp,char *coinaddr,int64_t value,uint32_t timestamp,bits256 txid,char *vinvoutstr,int32_t vinvout,int32_t height,char *otherheightstr,int32_t otherheight,uint64_t relaymask,int32_t ismine) { cJSON *item,*details; @@ -925,56 +890,6 @@ cJSON *basilisk_history_item(struct iguana_info *coin,int64_t *totalp,char *coin return(item); } -HASH_ARRAY_STRING(basilisk,history,hash,vals,hexstr) -{ - struct basilisk_unspent *bu; int32_t i; int64_t totalspent=0,total = 0; struct iguana_waccount *wacct,*tmp; struct iguana_waddress *waddr,*tmp2; char *symbol; cJSON *retjson,*array; struct basilisk_spend *s; - if ( vals == 0 ) - return(clonestr("{\"error\":\"need vals object\"}")); - //if ( coin == 0 ) - { - if ( (symbol= jstr(vals,"symbol")) != 0 || (symbol= jstr(vals,"coin")) != 0 ) - coin = iguana_coinfind(symbol); - } - if ( coin == 0 ) - return(clonestr("{\"error\":\"couldnt find coin\"}")); - //printf("history for (%s)\n",coin->symbol); - array = cJSON_CreateArray(); - portable_mutex_lock(&myinfo->bu_mutex); - HASH_ITER(hh,myinfo->wallet,wacct,tmp) - { - HASH_ITER(hh,wacct->waddr,waddr,tmp2) - { - for (i=0; inumunspents; i++) - { - bu = &waddr->unspents[i]; - if ( strcmp(bu->symbol,coin->symbol) == 0 ) - { - bitcoin_address(waddr->coinaddr,coin->chain->pubtype,waddr->rmd160,sizeof(waddr->rmd160)); - jaddi(array,basilisk_history_item(coin,&total,waddr->coinaddr,bu->value,bu->timestamp,bu->txid,"vout",bu->vout,bu->height,"spentheight",bu->spentheight,bu->relaymask,-1)); - //printf("%s %s i.%d numunspents.%d\n",coin->symbol,waddr->coinaddr,i,waddr->numunspents); - } - } - } - } - if ( myinfo->numspends > 0 ) - { - //spends = cJSON_CreateArray(); - for (i=0; inumspends; i++) - { - s = &myinfo->spends[i]; - //struct basilisk_spend { bits256 txid; uint64_t relaymask,value; uint32_t timestamp; int32_t vini,height,unspentheight,ismine; char destaddr[64]; }; - if ( strcmp(s->symbol,coin->symbol) == 0 ) - jaddi(array,basilisk_history_item(coin,&totalspent,s->destaddr,s->value,s->timestamp,s->txid,"vin",s->vini,s->height,"unspentheight",s->unspentheight,s->relaymask,s->ismine)); - } - } - portable_mutex_unlock(&myinfo->bu_mutex); - retjson = cJSON_CreateObject(); - jaddstr(retjson,"result","success"); - jadd(retjson,"history",array); - jaddstr(retjson,"coin",coin->symbol); - jaddnum(retjson,"balance",dstr(total)); - return(jprint(retjson,1)); -} #include "../includes/iguana_apiundefs.h" int32_t basilisk_unspentfind(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,uint8_t *spendscript,struct iguana_outpoint outpt,int64_t value) @@ -1172,7 +1087,7 @@ void basilisk_unspents_update(struct supernet_info *myinfo,struct iguana_info *c portable_mutex_lock(&myinfo->bu_mutex); if ( (retarray= cJSON_Parse(retstr)) != 0 ) { - //printf("%s UNSPENTS_UPDATE.(%s)\n",coin->symbol,retstr); + printf("%s UNSPENTS_UPDATE.(%s)\n",coin->symbol,retstr); if ( jobj(retarray,"error") == 0 ) { if ( (jstr(retarray,"ipaddr") == 0 || strcmp(jstr(retarray,"ipaddr"),myinfo->ipaddr) != 0) && (n= cJSON_GetArraySize(retarray)) > 0 ) diff --git a/iguana/coins/genmzc b/iguana/coins/genmzc new file mode 100755 index 000000000..8bbd87c40 --- /dev/null +++ b/iguana/coins/genmzc @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"maxpeers\":256,\"newcoin\":\"MZC\",\"name\":\"MazaCoin\",\"netmagic\":\"f8b503df\",\"p2p\":12835,\"rpc\":12832,\"pubval\":50,\"p2shval\":9,\"wifval\":224,\"txfee_satoshis\":\"0\",\"minconfirms\":2,\"genesishash\":\"00000c7c73d8ce604178dae13f0fc6ec0be3275614366d44b1b4b5c6e238c60c\",\"genesis\":{\"version\":1,\"timestamp\":1390747675,\"nBits\":\"1e0ffff0\",\"nonce\":2091390249,\"merkle_root\":\"62d496378e5834989dd9594cfc168dbb76f84a39bbda18286cddc7d1d1589f4f\"},\"alertpubkey\":\"04f09702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284\"}" diff --git a/iguana/coins/genuno b/iguana/coins/genuno new file mode 100755 index 000000000..522444975 --- /dev/null +++ b/iguana/coins/genuno @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"maxpeers\":256,\"newcoin\":\"UNO\",\"name\":\"Unobtanium\",\"netmagic\":\"03d5b503\",\"p2p\":65534,\"rpc\":65535,\"pubval\":130,\"p2shval\":30,\"wifval\":224,\"txfee_satoshis\":\"1000000\",\"minconfirms\":2,\"genesishash\":\"000004c2fc5fffb810dccc197d603690099a68305232e552d96ccbe8e2c52b75\",\"genesis\":{\"version\":1,\"timestamp\":1375548986,\"nBits\":\"1e0fffff\",\"nonce\":1211565,\"merkle_root\":\"36a192e90f70131a884fe541a1e8a5643a28ba4cb24cbb2924bd0ee483f7f484\"},\"alertpubkey\":\"04fd68acb6a895f3462d91b43eef0da845f0d531958a858554feab3ac330562bf76910700b3f7c29ee273ddc4da2bb5b953858f6958a50e8831eb43ee30c32f21d\"}" diff --git a/iguana/coins/genzet b/iguana/coins/genzet new file mode 100755 index 000000000..7a9b6a035 --- /dev/null +++ b/iguana/coins/genzet @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"maxpeers\":256,\"newcoin\":\"ZET\",\"name\":\"Zetacoin\",\"netmagic\":\"fab503df\",\"p2p\":17333,\"rpc\":17335,\"pubval\":80,\"p2shval\":9,\"wifval\":224,\"txfee_satoshis\":\"10000\",\"minconfirms\":2,\"genesishash\":\"000006cab7aa2be2da91015902aa4458dd5fbb8778d175c36d429dc986f2bff4\",\"genesis\":{\"version\":1,\"timestamp\":1375548986,\"nBits\":\"1e0fffff\",\"nonce\":2089928209,\"merkle_root\":\"d0227b8c3e3d07bce9656b3d9e474f050d23458aaead93357dcfdac9ab9b79f9\"},\"alertpubkey\":\"045337216002ca6a71d63edf062895417610a723d453e722bf4728996c58661cdac3d4dec5cecd449b9086e9602b35cc726a9e0163e1a4d40f521fbdaebb674658\"}" diff --git a/iguana/confs/DOGE_peers.txt b/iguana/confs/DOGE_peers.txt index 90cc29804..86a282c2a 100644 --- a/iguana/confs/DOGE_peers.txt +++ b/iguana/confs/DOGE_peers.txt @@ -29,3 +29,99 @@ 82.24.81.133 5.100.250.140 114.55.5.204 +31.179.43.191 +194.135.90.38 +198.50.242.34 +176.9.31.178 +85.25.41.70 +123.57.60.66 +5.196.82.175 +148.251.88.245 +163.172.19.96 +192.30.138.66 +72.207.111.81 +98.115.147.74 +174.50.64.101 +159.203.107.139 +50.191.229.7 +220.135.22.146 +120.55.80.212 +157.161.128.62 +96.48.162.59 +73.253.240.20 +149.210.242.48 +71.181.42.73 +178.32.9.103 +107.170.82.106 +210.28.136.11 +82.78.191.165 +96.126.123.143 +23.239.31.246 +176.9.50.227 +101.200.156.61 +31.41.40.25 +94.254.62.188 +107.170.86.160 +203.74.121.63 +121.40.17.150 +79.109.198.106 +192.95.56.199 +172.249.137.148 +24.249.152.169 +95.174.187.112 +146.0.32.101 +67.171.207.32 +76.185.84.244 +108.241.66.106 +31.184.195.115 +176.9.113.75 +178.63.18.3 +73.225.31.99 +139.196.9.71 +173.28.134.245 +192.95.29.153 +182.92.183.58 +173.236.240.49 +142.217.48.137 +192.99.11.57 +198.23.230.253 +85.243.255.154 +87.189.43.165 +54.201.183.106 +84.230.4.177 +220.240.96.156 +111.201.159.247 +78.84.100.95 +71.207.13.6 +84.253.125.186 +180.229.32.149 +121.42.206.214 +213.65.111.18 +65.13.189.227 +98.127.32.237 +65.28.164.248 +71.236.237.133 +24.22.225.211 +86.21.9.55 +144.76.239.66 +85.25.200.102 +92.255.199.98 +67.170.74.103 +98.162.199.30 +145.131.3.54 +81.7.3.24 +77.201.157.202 +104.131.40.196 +70.79.168.92 +71.80.233.61 +78.102.123.56 +120.146.143.87 +174.115.20.94 +24.255.204.177 +69.145.193.96 +80.68.90.161 +24.121.141.96 +176.9.65.41 +173.63.255.25 +69.42.223.118 +91.83.69.247 diff --git a/iguana/confs/MZC_peers.txt b/iguana/confs/MZC_peers.txt new file mode 100644 index 000000000..119b86f9e --- /dev/null +++ b/iguana/confs/MZC_peers.txt @@ -0,0 +1,81 @@ +188.226.195.226 +72.49.184.206 +84.22.108.241 +75.128.211.140 +176.31.53.252 +212.5.143.185 +205.197.252.41 +195.154.223.134 +142.4.218.174 +72.46.152.250 +45.63.65.112 +104.236.167.70 +142.4.218.175 +108.61.164.199 +107.170.173.232 +98.117.92.108 +192.95.29.153 +97.88.116.115 +24.206.113.66 +173.239.208.6 +24.107.101.162 +88.198.49.154 +193.107.94.202 +86.26.119.177 +198.27.97.172 +73.240.243.108 +98.127.109.96 +27.109.250.186 +79.64.13.216 +81.102.95.39 +92.14.74.221 +68.42.79.115 +85.169.119.123 +24.107.102.70 +151.80.206.101 +107.170.167.218 +151.80.9.33 +82.46.79.119 +63.247.147.166 +95.145.252.94 +113.52.87.159 +192.99.35.133 +12.35.68.211 +46.105.158.205 +72.84.241.101 +37.59.18.108 +104.172.24.79 +174.107.118.81 +76.106.178.145 +75.128.193.117 +158.69.27.82 +45.32.233.30 +84.22.106.192 +74.132.6.75 +45.55.153.77 +89.156.223.223 +94.23.32.109 +180.94.191.62 +45.55.220.222 +73.192.202.185 +186.90.15.65 +108.224.49.4 +84.237.85.210 +76.19.242.156 +73.157.167.155 +68.117.4.111 +98.18.22.32 +69.59.214.109 +198.84.218.9 +98.115.147.74 +71.7.124.80 +65.15.37.140 +217.44.16.102 +73.240.162.49 +23.80.94.149 +151.80.206.110 +50.254.73.158 +92.14.75.139 +188.124.91.76 +66.189.11.251 +184.17.228.71 diff --git a/iguana/confs/UNO_peers.txt b/iguana/confs/UNO_peers.txt new file mode 100644 index 000000000..1be6bbfac --- /dev/null +++ b/iguana/confs/UNO_peers.txt @@ -0,0 +1,8 @@ +195.154.223.134 +216.146.143.177 +173.183.179.144 +144.76.176.12 +87.189.45.29 +188.138.94.6 +144.76.239.66 +144.76.64.123 diff --git a/iguana/confs/ZET_peers.txt b/iguana/confs/ZET_peers.txt new file mode 100644 index 000000000..9ec947e9d --- /dev/null +++ b/iguana/confs/ZET_peers.txt @@ -0,0 +1,8 @@ +208.94.242.218 +85.25.217.233 +76.95.178.229 +155.94.243.135 +108.61.10.90 +155.254.49.54 +198.27.81.25 +94.249.166.140 diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 21415be47..0b7592b43 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -564,7 +564,7 @@ int32_t iguana_RTpkhasharray(struct supernet_info *myinfo,struct iguana_info *co if ( i != max && (bp= coin->bundles[i]) == 0 ) continue; else bp = 0; - if ( bp != 0 ) + if ( 0 && bp != 0 ) { if ( lastheight > 0 && bp->bundleheight > lastheight ) { diff --git a/iguana/iguana_volatiles.c b/iguana/iguana_volatiles.c index 66dd5d543..84a486d5b 100755 --- a/iguana/iguana_volatiles.c +++ b/iguana/iguana_volatiles.c @@ -191,6 +191,7 @@ int32_t iguana_RTutxofunc(struct iguana_info *coin,int32_t *fromheightp,int32_t } else utxo.lockedflag = 0; if ( utxo.spentflag != 0 || utxo.lockedflag != 0 ) *RTspendflagp = 1; + *fromheightp = utxo.fromheight; return(utxo.spentflag); } @@ -221,13 +222,16 @@ int32_t iguana_RTspentflag(struct supernet_info *myinfo,struct iguana_info *coin if ( (rdata= ramchain->H.data) == 0 ) return(0); numunspents = rdata->numunspents; - if ( height == 0 ) + spentflag = iguana_RTutxofunc(coin,&fromheight,&lockedflag,spentpt,&RTspentflag,0,0); + if ( spentflag != 0 && fromheight == 0 ) { - //printf("%s illegal unspentind.%u vs %u hdrs.%d zero fromheight.%d?\n",coin->symbol,spentpt.unspentind,numunspents,spentpt.hdrsi,fromheight); - height = spentpt.hdrsi*coin->chain->bundlesize + 1; + if ( height == 0 ) + { + //printf("%s illegal unspentind.%u vs %u hdrs.%d zero fromheight.%d?\n",coin->symbol,spentpt.unspentind,numunspents,spentpt.hdrsi,fromheight); + height = spentpt.hdrsi*coin->chain->bundlesize + 1; + } + fromheight = height; } - fromheight = height; - spentflag = iguana_RTutxofunc(coin,&fromheight,&lockedflag,spentpt,&RTspentflag,0,0); if ( RTspentflag != 0 ) *RTspendp += (amount == 0) ? coin->txfee : amount; //printf("[%d] u%u %.8f, spentheight.%d vs height.%d spentflag.%d\n",spent_hdrsi,spent_unspentind,dstr(amount),fromheight,height,spentflag); diff --git a/iguana/iguana_wallet.c b/iguana/iguana_wallet.c index 1fdb14521..df938fdd7 100755 --- a/iguana/iguana_wallet.c +++ b/iguana/iguana_wallet.c @@ -291,7 +291,7 @@ uint8_t *iguana_walletrmds(struct supernet_info *myinfo,struct iguana_info *coin cJSON *iguana_getaddressesbyaccount(struct supernet_info *myinfo,struct iguana_info *coin,char *account) { - struct iguana_waccount *subset,*tmp; char coinaddr[64]; struct iguana_waddress *waddr,*tmp2; cJSON *retjson,*array; + struct iguana_waccount *subset,*tmp; char refaddr[64],coinaddr[64]; struct iguana_waddress *waddr,*tmp2; cJSON *retjson,*array; retjson = cJSON_CreateObject(); array = cJSON_CreateArray(); if ( account == 0 || account[0] == 0 ) @@ -310,14 +310,19 @@ cJSON *iguana_getaddressesbyaccount(struct supernet_info *myinfo,struct iguana_i } else { + bitcoin_address(refaddr,coin->chain->pubtype,myinfo->persistent_pubkey33,33); HASH_ITER(hh,myinfo->wallet,subset,tmp) { HASH_ITER(hh,subset->waddr,waddr,tmp2) { bitcoin_address(coinaddr,coin->chain->pubtype,waddr->rmd160,20); jaddistr(array,coinaddr); + if ( strcmp(coinaddr,refaddr) == 0 ) + refaddr[0] = 0; } } + if ( refaddr[0] != 0 ) + jaddistr(array,refaddr); } return(array); } diff --git a/iguana/ramchain_api.c b/iguana/ramchain_api.c index 8d2e9862e..5db58b16d 100755 --- a/iguana/ramchain_api.c +++ b/iguana/ramchain_api.c @@ -53,7 +53,7 @@ TWO_STRINGS_AND_TWO_DOUBLES(iguana,balance,activecoin,address,lastheightd,mincon //printf("Start %s balance.(%s) height.%d\n",coin->symbol,address,lastheight); if ( lastheight == 0 ) lastheight = IGUANA_MAXHEIGHT; - iguana_RTpkhasharray(myinfo,coin,array,minconf,maxconf,&total,P,coin->bundlescount,rmd160,address,pubkey33,lastheight,0,0,0,remoteaddr,0); + iguana_RTpkhasharray(myinfo,coin,array,minconf,maxconf,&total,P,coin->bundlescount,rmd160,address,pubkey33,lastheight,0,0,0,remoteaddr,1); free(P); jadd(retjson,"unspents",array); jaddnum(retjson,"balance",dstr(total));