CatapultServer  v0.5.0.1 (Elephant)
ChildNamespaceAvailabilityValidator.cpp File Reference
Include dependency graph for ChildNamespaceAvailabilityValidator.cpp:

Namespaces

 catapult
 
 catapult::validators
 

Functions

 catapult::validators::DEFINE_STATEFUL_VALIDATOR (ChildNamespaceAvailability, [](const auto &notification, const ValidatorContext &context) { const auto &cache=context.Cache.sub< cache::NamespaceCache >();auto height=context.Height;if(cache.contains(notification.NamespaceId)) return Failure_Namespace_Already_Exists;if(!cache.contains(notification.ParentId)) return Failure_Namespace_Parent_Unknown;auto namespaceIter=cache.find(notification.ParentId);const auto &parentEntry=namespaceIter.get();const auto &parentPath=parentEntry.ns().path();if(parentPath.size()==parentPath.capacity()) return Failure_Namespace_Too_Deep;const auto &root=parentEntry.root();if(!root.lifetime().isActiveAndUnlocked(height)) return Failure_Namespace_Expired;if(root.owner() !=notification.Signer) return Failure_Namespace_Owner_Conflict;return ValidationResult::Success;})