else
{
CConstVerusSolutionVector::activationHeight.SetActivationHeight(CActivationHeight::SOLUTION_VERUSV2, 1);
- CConstVerusSolutionVector::activationHeight.SetActivationHeight(CActivationHeight::SOLUTION_VERUSV3, 200);
+ CConstVerusSolutionVector::activationHeight.SetActivationHeight(CActivationHeight::SOLUTION_VERUSV3, 110);
//CConstVerusSolutionVector::activationHeight.SetActivationHeight(CActivationHeight::SOLUTION_VERUSV4, 1);
}
}
#include <string.h>
#include <algorithm>
+extern uint160 VERUS_CHAINID;
+
namespace
{
class DestinationEncoder : public boost::static_visitor<std::string>
}
else if (std::count(str.begin(), str.end(), '@') == 1)
{
- return CIdentityID(CIdentity::GetID(str, uint160()));
+ return CIdentityID(CIdentity::GetID(str, VERUS_CHAINID));
}
return CNoDestination();
#include "streams.h"
#include "pubkey.h"
#include "base58.h"
+#include "boost/algorithm/string.hpp"
static const int DEFAULT_RPC_TIMEOUT=900;
static const uint32_t PBAAS_VERSION = 1;
inline static uint160 GetChainID(std::string name)
{
- const char *chainName = name.c_str();
+ const char *chainName = boost::algorithm::to_lower_copy(name).c_str();
uint256 chainHash = Hash(chainName, chainName + strlen(chainName));
return Hash160(chainHash.begin(), chainHash.end());
}
return state.Error("Invalid identity redefinition");
}
+ // CHECK #3 - must be rooted in this chain
+ if (newIdentity.parent != ConnectedChains.ThisChain().GetChainID())
+ {
+ return state.Error("Identity parent of new identity must be current chain");
+ }
+
// CHECK #3a - if dupID is valid, we need to be spending it to recover. redefinition is invalid
CTxIn idTxIn;
uint32_t priorHeightOut;
{
AssertLockHeld(cs_main);
+ bool validReservation = false;
+ bool validIdentity = false;
+
+ CNameReservation nameRes;
+ CIdentity identity;
+
for (auto &output : tx.vout)
{
COptCCParams p;
- if (output.scriptPubKey.IsPayToCryptoCondition(p) && p.IsValid() && p.version >= COptCCParams::VERSION_V3 && p.evalCode == EVAL_IDENTITY_RESERVATION)
+ if (output.scriptPubKey.IsPayToCryptoCondition(p) && p.IsValid() && p.version >= COptCCParams::VERSION_V3 && p.evalCode == EVAL_IDENTITY_RESERVATION && p.vData.size() > 1 && (nameRes = CNameReservation(p.vData[0])).IsValid())
{
- return true;
+ // twice through makes it invalid
+ if (validReservation)
+ {
+ return state.Error("Invalid multiple identity reservations on one transaction");
+ }
+ validReservation = true;
+ }
+ else if (p.IsValid() && p.version >= COptCCParams::VERSION_V3 && p.evalCode == EVAL_IDENTITY_PRIMARY && p.vData.size() > 1 && (identity = CIdentity(p.vData[0])).IsValid())
+ {
+ // twice through makes it invalid
+ if (validIdentity)
+ {
+ return state.Error("Invalid multiple identity definitions on one transaction");
+ }
+ validIdentity = true;
}
}
// if we made it to here without an early, positive exit, we must determine that we are spending a matching identity, and if so, all is fine so far
CTransaction inTx;
uint256 blkHash;
- CIdentity identity;
COptCCParams p;
LOCK(mempool.cs);
for (auto &input : tx.vin)
uint160 CPBaaSChainDefinition::GetChainID(std::string name)
{
- const char *chainName = name.c_str();
- uint256 chainHash = Hash(chainName, chainName + strlen(chainName));
- return Hash160(chainHash.begin(), chainHash.end());
+ return CCrossChainRPCData::GetChainID(name);
}
uint160 CPBaaSChainDefinition::GetConditionID(int32_t condition) const
CheckIdentityAPIsValid();
- uint160 parent = IsVerusActive() ? uint160() : ConnectedChains.ThisChain().GetChainID();
+ uint160 parent;
std::string name = CleanName(uni_get_str(params[0]), parent);
// if either we have an invalid name or an implied parent, that is not valid
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid name for commitment");
}
+ parent = ConnectedChains.ThisChain().GetChainID();
+
CTxDestination dest = DecodeDestination(uni_get_str(params[1]));
if (dest.which() == COptCCParams::ADDRTYPE_INVALID)
{
CheckIdentityAPIsValid();
- // all names have a parent of the current chain, except if defined on the Verus chain, which has a parent of null
- uint160 parent = IsVerusActive() ? uint160() : ConnectedChains.ThisChain().GetChainID();
+ // all names have a parent of the current chain
+ uint160 parent = ConnectedChains.ThisChain().GetChainID();
uint256 txid = uint256S(uni_get_str(find_value(params[0], "txid")));
CNameReservation reservation(find_value(params[0], "namereservation"));