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

Namespaces

 catapult
 
 catapult::observers
 

Functions

 catapult::observers::DEFINE_OBSERVER (SecretLock, Notification, [](const auto &notification, ObserverContext &context) { auto &cache=context.Cache.sub< cache::SecretLockInfoCache >();if(NotifyMode::Commit==context.Mode) { auto endHeight=context.Height+Height(notification.Duration.unwrap());auto mosaicId=context.Resolvers.resolve(notification.Mosaic.MosaicId);cache.insert(CreateLockInfo(notification.Signer, mosaicId, endHeight, notification, context.Resolvers));auto receiptType=model::Receipt_Type_LockSecret_Created;model::BalanceChangeReceipt receipt(receiptType, notification.Signer, mosaicId, notification.Mosaic.Amount);context.StatementBuilder().addReceipt(receipt);} else { cache.remove(model::CalculateSecretLockInfoHash(notification.Secret, context.Resolvers.resolve(notification.Recipient)));} })