Browse Source

Explorer fix, make defaultid default to notaryid

dev
miketout 2 years ago
parent
commit
65ad097de4
  1. 4
      src/init.cpp
  2. 18
      src/rpc/misc.cpp

4
src/init.cpp

@ -1265,10 +1265,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
// get default IDs and addresses
auto defaultIDDest = DecodeDestination(GetArg("-defaultid", ""));
VERUS_DEFAULTID = defaultIDDest.which() == COptCCParams::ADDRTYPE_ID ? CIdentityID(GetDestinationID(defaultIDDest)) : CIdentityID();
auto notaryIDDest = DecodeDestination(GetArg("-notaryid", ""));
VERUS_NOTARYID = notaryIDDest.which() == COptCCParams::ADDRTYPE_ID ? CIdentityID(GetDestinationID(notaryIDDest)) : CIdentityID();
auto defaultIDDest = DecodeDestination(GetArg("-defaultid", VERUS_NOTARYID.IsNull() ? "" : EncodeDestination(notaryIDDest)));
VERUS_DEFAULTID = defaultIDDest.which() == COptCCParams::ADDRTYPE_ID ? CIdentityID(GetDestinationID(defaultIDDest)) : CIdentityID();
auto nodeIDDest = DecodeDestination(GetArg("-nodeid", ""));
VERUS_NODEID = nodeIDDest.which() == COptCCParams::ADDRTYPE_ID ? GetDestinationID(nodeIDDest) : uint160();
VERUS_DEFAULT_ZADDR = GetArg("-cheatcatcher", "");

18
src/rpc/misc.cpp

@ -1639,7 +1639,14 @@ void CurrencyValuesAndNames(UniValue &output, bool spending, const CTransaction
}
else
{
script = tx.vout[index].scriptPubKey;
if (tx.vout.size() > index && index >= 0)
{
script = tx.vout[index].scriptPubKey;
}
else
{
throw JSONRPCError(RPC_DATABASE_ERROR, "Unable to retrieve data to for currency output values");
}
}
return CurrencyValuesAndNames(output, spending, script, satoshis, friendlyNames);
}
@ -1672,7 +1679,10 @@ UniValue AddressMemPoolUni(const std::vector<std::pair<uint160, int>> &addresses
delta.push_back(Pair("index", (int)it->first.index));
delta.push_back(Pair("satoshis", it->second.amount));
delta.push_back(Pair("spending", (bool)it->first.spending));
CurrencyValuesAndNames(delta, it->first.spending, curTx, it->first.index, it->second.amount, friendlyNames);
if (!it->first.txhash.IsNull() && it->first.txhash == curTx.GetHash() || mempool.lookup(it->first.txhash, curTx))
{
CurrencyValuesAndNames(delta, it->first.spending, curTx, it->first.index, it->second.amount, friendlyNames);
}
delta.push_back(Pair("timestamp", it->second.time));
if (it->second.amount < 0) {
delta.push_back(Pair("prevtxid", it->second.prevhash.GetHex()));
@ -1957,7 +1967,7 @@ UniValue getaddressdeltas(const UniValue& params, bool fHelp)
}
uint256 blockHash;
if (verbosity && (it->first.txhash == curTx.GetHash() || myGetTransaction(it->first.txhash, curTx, blockHash)))
if (verbosity && !it->first.txhash.IsNull() && (it->first.txhash == curTx.GetHash() || myGetTransaction(it->first.txhash, curTx, blockHash)))
{
CurrencyValuesAndNames(delta, it->first.spending, curTx, it->first.index, it->second, friendlyNames);
}
@ -2049,7 +2059,7 @@ UniValue getaddressbalance(const UniValue& params, bool fHelp)
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++) {
uint256 blockHash;
if (it->first.txhash == curTx.GetHash() || myGetTransaction(it->first.txhash, curTx, blockHash))
if (!it->first.txhash.IsNull() && (it->first.txhash == curTx.GetHash() || myGetTransaction(it->first.txhash, curTx, blockHash)))
{
if (it->first.spending) {
CTransaction priorOutTx;

Loading…
Cancel
Save