diff --git a/iguana/exchanges/LP_coins.c b/iguana/exchanges/LP_coins.c index 7115d8680..9bbc64f1f 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -536,13 +536,20 @@ struct iguana_info *LP_coincreate(cJSON *item) if (txversion == 0) { txversion = 1; } - if ( LP_coininit(&cdata,symbol,name,assetname==0?"":assetname,isPoS,port,pubtype,p2shtype,wiftype,txfee,estimatedrate,longestchain,juint(item,"wiftaddr"),juint(item,"taddr"),LP_busport(port),jstr(item,"confpath"),decimals,txversion) < 0 ) - { - coin = LP_coinadd(&cdata); - coin->inactive = (uint32_t)time(NULL); - if ( coin->isassetchain != 0 && strcmp(symbol,"OOT") != 0 && strcmp(symbol,"ZILLA") != 0 ) - coin->txversion = 4; - } else coin = LP_coinadd(&cdata); + + uint16_t port = LP_coininit(&cdata,symbol,name,assetname==0?"":assetname,isPoS,port,pubtype,p2shtype,wiftype,txfee,estimatedrate,longestchain,juint(item,"wiftaddr"),juint(item,"taddr"),LP_busport(port),jstr(item,"confpath"),decimals,txversion); + + coin = LP_coinadd(&cdata); + coin->inactive = (uint32_t)time(NULL); + + // here we assume that any assetchain except OOT and ZILLA are sapling active with txversion=4, + // TODO: get "blocks" and "sapling" from daemon's "getinfo" rpc to make proper check + + if ( coin->isassetchain != 0 && strcmp(symbol,"OOT") != 0 && strcmp(symbol,"ZILLA") != 0 ) + coin->txversion = 4; + + if (coin !=0) printf("[ Debug ] LP_coincreate: symbol.%s name.%s assetname.%s port.%d isassetchain.%d txversion.%d\n", symbol, name, assetname, port, coin->isassetchain, coin->txversion); + } else if ( symbol != 0 && jobj(item,"rpcport") == 0 ) printf("SKIP %s, missing rpcport field in coins array\n",symbol); if ( coin != 0 && item != 0 )