diff --git a/iguana/exchanges/LP_coins.c b/iguana/exchanges/LP_coins.c index 5de4359b2..2a8d4207a 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -145,11 +145,17 @@ cJSON *LP_coinjson(struct iguana_info *coin) { cJSON *item = cJSON_CreateObject(); jaddstr(item,"coin",coin->symbol); + if ( coin->inactive != 0 ) + jaddstr(item,"status","inactive"); + if ( coin->isPoS != 0 ) + jaddstr(item,"type","PoS"); jaddstr(item,"smartaddress",coin->smartaddr); jaddstr(item,"rpc",coin->serverport); jaddnum(item,"pubtype",coin->pubtype); jaddnum(item,"p2shtype",coin->p2shtype); jaddnum(item,"wiftype",coin->wiftype); + jaddnum(item,"estimatedrate",coin->estimatedrate); + jaddnum(item,"txfee",coin->txfee); return(item); } @@ -162,11 +168,12 @@ cJSON *LP_coinsjson() return(array); } -void LP_coininit(struct iguana_info *coin,char *symbol,char *name,char *assetname,uint16_t port,uint8_t pubtype,uint8_t p2shtype,uint8_t wiftype,uint64_t txfee,double estimatedrate,int32_t longestchain) +void LP_coininit(struct iguana_info *coin,char *symbol,char *name,char *assetname,int32_t isPoS,uint16_t port,uint8_t pubtype,uint8_t p2shtype,uint8_t wiftype,uint64_t txfee,double estimatedrate,int32_t longestchain) { memset(coin,0,sizeof(*coin)); safecopy(coin->symbol,symbol,sizeof(coin->symbol)); sprintf(coin->serverport,"127.0.0.1:%u",port); + coin->isPoS = isPoS; coin->longestchain = longestchain; coin->txfee = txfee; coin->estimatedrate = estimatedrate; @@ -198,11 +205,12 @@ struct iguana_info *LP_coinsearch(char *symbol) struct iguana_info *LP_coinfind(char *symbol) { - struct iguana_info *coin,cdata; int32_t longestchain = 1000000; uint16_t port; uint64_t txfee; double estimatedrate; uint8_t pubtype,p2shtype,wiftype; char *name,*assetname; + struct iguana_info *coin,cdata; int32_t isPoS,longestchain = 1000000; uint16_t port; uint64_t txfee; double estimatedrate; uint8_t pubtype,p2shtype,wiftype; char *name,*assetname; if ( (coin= LP_coinsearch(symbol)) != 0 ) return(coin); if ( (port= LP_rpcport(symbol)) == 0 ) return(0); + isPoS = 0; txfee = 10000; estimatedrate = 20; pubtype = 60; @@ -225,7 +233,7 @@ struct iguana_info *LP_coinfind(char *symbol) name = symbol; assetname = symbol; } - LP_coininit(&cdata,symbol,name,assetname,port,pubtype,p2shtype,wiftype,txfee,estimatedrate,longestchain); + LP_coininit(&cdata,symbol,name,assetname,isPoS,port,pubtype,p2shtype,wiftype,txfee,estimatedrate,longestchain); return(LP_coinadd(&cdata)); } @@ -233,9 +241,10 @@ struct iguana_info *LP_coinfind(char *symbol) struct iguana_info *LP_coincreate(cJSON *item) { - struct iguana_info cdata; int32_t longestchain = 1000000; uint16_t port; uint64_t txfee; double estimatedrate; uint8_t pubtype,p2shtype,wiftype; char *name,*symbol,*assetname; + struct iguana_info cdata,*coin; int32_t isPoS,longestchain = 1000000; uint16_t port; uint64_t txfee; double estimatedrate; uint8_t pubtype,p2shtype,wiftype; char *name,*symbol,*assetname; if ( (symbol= jstr(item,"coin")) != 0 && symbol[0] != 0 && strlen(symbol) < 16 && LP_coinfind(symbol) == 0 && (port= juint(item,"rpcport")) != 0 ) { + isPoS = jint(item,"isPoS"); if ( (txfee= j64bits(item,"txfee")) == 0 ) txfee = 10000; if ( (estimatedrate= jdouble(item,"estimatedrate")) == 0. ) @@ -250,8 +259,9 @@ struct iguana_info *LP_coincreate(cJSON *item) name = assetname; else if ( (name= jstr(item,"name")) == 0 ) name = symbol; - LP_coininit(&cdata,symbol,name,assetname==0?"":assetname,port,pubtype,p2shtype,wiftype,txfee,estimatedrate,longestchain); - return(LP_coinadd(&cdata)); + LP_coininit(&cdata,symbol,name,assetname==0?"":assetname,isPoS,port,pubtype,p2shtype,wiftype,txfee,estimatedrate,longestchain); + if ( (coin= LP_coinadd(&cdata)) != 0 ) + coin->inactive = jint(item,"inactive"); } return(0); } diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 366ab2556..7d873c0c4 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -314,6 +314,8 @@ char *stats_JSON(cJSON *argjson,char *remoteaddr,uint16_t port) // from rpc port retstr = LP_connected(argjson); else if ( strcmp(method,"checktxid") == 0 ) retstr = LP_spentcheck(argjson); + else if ( strcmp(method,"getcoins") == 0 ) + retstr = jprint(LP_coinsjson(),1); else if ( strcmp(method,"getprice") == 0 ) retstr = LP_pricestr(jstr(argjson,"base"),jstr(argjson,"rel")); else if ( strcmp(method,"orderbook") == 0 ) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 9b194a908..e418c6899 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -140,7 +140,7 @@ struct basilisk_swapinfo struct iguana_info { uint64_t txfee; double estimatedrate; - int32_t longestchain; uint32_t counter; + int32_t longestchain; uint32_t counter,inactive; uint8_t pubtype,p2shtype,isPoS,wiftype; char symbol[16],smartaddr[64],userpass[1024],serverport[128]; }; diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 4f7dc7eb9..e0847f382 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -411,7 +411,7 @@ uint64_t LP_privkey_init(struct LP_peerinfo *mypeer,int32_t mypubsock,char *symb } bitcoin_addr2rmd160(&tmptype,rmd160,coin->smartaddr); LP_privkeyadd(privkey,rmd160); - if ( (array= LP_listunspent(symbol,coin->smartaddr)) != 0 ) + if ( coin->inactive == 0 && (array= LP_listunspent(symbol,coin->smartaddr)) != 0 ) { if ( is_cJSON_Array(array) != 0 && (n= cJSON_GetArraySize(array)) > 0 ) { diff --git a/iguana/exchanges/client b/iguana/exchanges/client index 9b10b48a7..52a5fe77f 100755 --- a/iguana/exchanges/client +++ b/iguana/exchanges/client @@ -3,5 +3,4 @@ pkill -15 marketmaker; git pull; cd ..; ./m_mm; -#./marketmaker "{\"client\":1,\"coins\":[{\"coin\":\"REVS\", \"asset\":\"REVS\", \"rpcport\":10196}, {\"coin\":\"JUMBLR\", \"asset\":\"JUMBLR\", \"rpcport\":15106}, {\"coin\":\"LTC\", \"name\":\"litecoin\", \"rpcport\":9332, \"pubtype\":48, \"p2shtype\":5, \"wiftype\":176, \"txfee\":100000 }], \"userhome\":\"/${HOME#"/"}\",\"passphrase\":\"$randval\"}" & - ./marketmaker "{\"client\":1,\"coins\":[{\"coin\":\"REVS\", \"asset\":\"REVS\", \"rpcport\":10196}, {\"coin\":\"JUMBLR\", \"asset\":\"JUMBLR\", \"rpcport\":15106}], \"userhome\":\"/${HOME#"/"}\",\"passphrase\":\"$randval\"}" & +./marketmaker "{\"client\":1,\"coins\":[{\"coin\":\"REVS\", \"asset\":\"REVS\", \"rpcport\":10196}, {\"coin\":\"JUMBLR\", \"asset\":\"JUMBLR\", \"rpcport\":15106}, {\"coin\":\"LTC\", \"inactive\":1, \"name\":\"litecoin\", \"rpcport\":9332, \"pubtype\":48, \"p2shtype\":5, \"wiftype\":176, \"txfee\":100000 }], \"userhome\":\"/${HOME#"/"}\",\"passphrase\":\"$randval\"}" &