Browse Source

fix txversion for assetchains

earlier it was txversion=1 for all assetchains, even sapling active,
during small bug in code. LP_coininit returns a positive (!) value of
port number (unsigned value) and we somehow was compared it with < 0 .
as a result part of code to assign txversion never executed.
blackjok3r
DeckerSU 6 years ago
parent
commit
dbff3506f2
  1. 21
      iguana/exchanges/LP_coins.c

21
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 )

Loading…
Cancel
Save