diff --git a/src/init.cpp b/src/init.cpp index 6a4c1eb8a..7a5b2d458 100644 --- a/src/init.cpp +++ b/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", ""); diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index f80c90d94..53a3a9cda 100644 --- a/src/rpc/misc.cpp +++ b/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> &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 >::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;