Browse Source

vdxfid client json parsing fix & misc cleanup

dev
miketout 2 years ago
parent
commit
fb5889e588
  1. 2
      src/komodo_globals.h
  2. 2
      src/pbaas/pbaas.cpp
  3. 1
      src/rpc/client.cpp
  4. 18
      src/rpc/misc.cpp

2
src/komodo_globals.h

@ -96,7 +96,7 @@ uint32_t ASSETCHAINS_STARTING_DIFF = 0;
// Verus proof of stake controls
int32_t ASSETCHAINS_LWMAPOS = 0; // percentage of blocks should be PoS
int32_t VERUS_BLOCK_POSUNITS = 1024; // one block is 1000 units
int32_t VERUS_MIN_STAKEAGE = 150; // 1/2 this should also be a cap on the POS averaging window, or startup could be too easy
int32_t VERUS_MIN_STAKEAGE = 150; // 2x this should also be a cap on the POS averaging window, or startup could be too easy
int32_t VERUS_CONSECUTIVE_POS_THRESHOLD = 7; // this gives us 9 in a row
int32_t VERUS_PBAAS_CONSECUTIVE_POS_THRESHOLD = 3; // reduce to max 5 in a row
int32_t VERUS_NOPOS_THRESHHOLD = 150; // if we have no POS blocks in this many blocks, reset difficulty

2
src/pbaas/pbaas.cpp

@ -3780,7 +3780,7 @@ std::string CConnectedChains::GetFriendlyCurrencyName(const uint160 &currencyID)
std::string retName;
uint160 curID = currencyID;
CCurrencyDefinition curDef;
for (curDef = GetCachedCurrency(curID); curDef.IsValid(); curDef = GetCachedCurrency(curID))
for (curDef = GetCachedCurrency(curID); curDef.IsValid(); curDef = curID.IsNull() ? CCurrencyDefinition() : GetCachedCurrency(curID))
{
if (curDef.parent.IsNull())
{

1
src/rpc/client.cpp

@ -1710,6 +1710,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "makeoffer", 1},
{ "takeoffer", 1},
{ "closeoffers", 0},
{ "getvdxfid", 1},
// Zcash addition
{ "z_setmigration", 0},
};

18
src/rpc/misc.cpp

@ -1585,8 +1585,8 @@ bool timestampSort(std::pair<CMempoolAddressDeltaKey, CMempoolAddressDelta> a,
}
void CurrencyValuesAndNames(UniValue &output, bool spending, const CScript script, CAmount satoshis, bool friendlyNames=false);
void CurrencyValuesAndNames(UniValue &output, bool spending, const CScript script, CAmount satoshis, bool friendlyNames)
void CurrencyValuesAndNames(UniValue &output, bool spending, const CScript &script, CAmount satoshis, bool friendlyNames=false);
void CurrencyValuesAndNames(UniValue &output, bool spending, const CScript &script, CAmount satoshis, bool friendlyNames)
{
if (CConstVerusSolutionVector::GetVersionByHeight(chainActive.Height()) >= CActivationHeight::ACTIVATE_PBAAS)
{
@ -1609,7 +1609,7 @@ void CurrencyValuesAndNames(UniValue &output, bool spending, const CScript scrip
currencyBal.push_back(make_pair(name, ValueFromAmount(oneBalance.second)));
if (friendlyNames)
{
currencyNames.push_back(make_pair(name, ConnectedChains.GetFriendlyCurrencyName(oneBalance.first)));
currencyNames.pushKV(name, ConnectedChains.GetFriendlyCurrencyName(oneBalance.first));
}
}
output.pushKV("currencyvalues", currencyBal);
@ -1795,7 +1795,8 @@ UniValue getaddressutxos(const UniValue& params, bool fHelp)
std::string address = "";
if (it->second.script.IsPayToCryptoCondition())
COptCCParams p;
if (it->second.script.IsPayToCryptoCondition(p) && p.IsValid())
{
txnouttype outType;
std::vector<CTxDestination> addresses;
@ -1826,7 +1827,14 @@ UniValue getaddressutxos(const UniValue& params, bool fHelp)
output.push_back(Pair("txid", it->first.txhash.GetHex()));
output.push_back(Pair("outputIndex", (int)it->first.index));
output.push_back(Pair("script", HexStr(it->second.script.begin(), it->second.script.end())));
CurrencyValuesAndNames(output, false, it->second.script, it->second.satoshis, friendlyNames);
if (p.IsValid())
{
CurrencyValuesAndNames(output, false, it->second.script, it->second.satoshis, friendlyNames);
}
else
{
UniValue
}
output.push_back(Pair("satoshis", it->second.satoshis));
output.push_back(Pair("height", it->second.blockHeight));
if (chainActive.Height() >= it->second.blockHeight)

Loading…
Cancel
Save