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

Namespaces

 catapult
 
 catapult::validators
 

Functions

 catapult::validators::DEFINE_STATELESS_VALIDATOR (ModifyMultisigCosigners, [](const auto &notification) { utils::KeyPointerSet addedAccounts;utils::KeyPointerSet removedAccounts;const auto *pModifications=notification.ModificationsPtr;for(auto i=0u;i< notification.ModificationsCount;++i) { if(!IsValidModificationType(pModifications[i].ModificationType)) return Failure_Multisig_Modify_Unsupported_Modification_Type;auto &accounts=model::CosignatoryModificationType::Add==pModifications[i].ModificationType ? addedAccounts :removedAccounts;const auto &oppositeAccounts=&accounts==&addedAccounts ? removedAccounts :addedAccounts;auto &key=pModifications[i].CosignatoryPublicKey;if(oppositeAccounts.end() !=oppositeAccounts.find(&key)) return Failure_Multisig_Modify_Account_In_Both_Sets;accounts.insert(&key);} if(1< removedAccounts.size()) return Failure_Multisig_Modify_Multiple_Deletes;if(notification.ModificationsCount !=addedAccounts.size()+removedAccounts.size()) return Failure_Multisig_Modify_Redundant_Modifications;return ValidationResult::Success;})