vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
- //fMiningRequiresPeers = true;
+ fMiningRequiresPeers = true;
fDefaultConsistencyChecks = false;
fRequireStandard = true;
fMineBlocksOnDemand = false;
std::vector<unsigned char> GetDestinationBytes(const CTxDestination& dest);
uint160 GetDestinationID(const CTxDestination dest);
CTxDestination DecodeDestination(const std::string& str);
+CTxDestination ValidateDestination(const std::string &destStr);
bool IsValidDestinationString(const std::string& str);
bool IsValidDestinationString(const std::string& str, const CChainParams& params);
return GetCurrencyDefinition(CCrossChainRPCData::GetID(name), chainDef);
}
+CTxDestination ValidateDestination(const std::string &destStr)
+{
+ CTxDestination destination = DecodeDestination(destStr);
+ CTransferDestination transferDestination;
+ if (destination.which() == COptCCParams::ADDRTYPE_ID)
+ {
+ AssertLockHeld(cs_main);
+ if (!CIdentity::LookupIdentity(GetDestinationID(destination)).IsValid())
+ {
+ return CTxDestination();
+ }
+ }
+ return destination;
+}
+
// set default peer nodes in the current connected chains
bool SetPeerNodes(const UniValue &nodes)
{
throw JSONRPCError(RPC_INVALID_PARAMETER, "Only the ID of a mintable currency can mint such a currency. Minting cannot be combined with conversion.");
}
- CTxDestination destination = DecodeDestination(destStr);
+ CTxDestination destination = ValidateDestination(destStr);
CTransferDestination transferDestination;
if (destination.which() == COptCCParams::ADDRTYPE_INVALID)
{
}
rawDestBytes.insert(rawDestBytes.end(), subNames[i].begin(), subNames[i].end());
}
+ if (!rawDestBytes.size())
+ {
+ throw JSONRPCError(RPC_INVALID_PARAMETER, "Specified destination must be valid.");
+ }
transferDestination = CTransferDestination(CTransferDestination::DEST_RAW, rawDestBytes);
}
else
throw JSONRPCError(RPC_INVALID_PARAMETER, "Specified destination must be valid.");
}
}
- else if (destination.which() == COptCCParams::ADDRTYPE_ID)
- {
- if (!CIdentity::LookupIdentity(GetDestinationID(destination)).IsValid())
- {
- throw JSONRPCError(RPC_INVALID_PARAMETER, "When sending to an ID, the ID must be valid.");
- }
- }
CTxDestination refundDestination = DecodeDestination(refundToStr);
if (refundDestination.which() == COptCCParams::ADDRTYPE_ID &&
LOCK2(cs_main, pwalletMain->cs_wallet);
- CTxDestination dest = DecodeDestination(params[0].get_str());
+ CTxDestination dest = ValidateDestination(params[0].get_str());
+
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Verus address");
}
string address = find_value(o, "address").get_str();
bool isZaddr = false;
- CTxDestination taddr = DecodeDestination(address);
+ CTxDestination taddr = ValidateDestination(address);
if (!IsValidDestination(taddr)) {
auto res = DecodePaymentAddress(address);
if (IsValidPaymentAddress(res, branchId)) {