| catapult::observers::DEFINE_OBSERVER (SecretLock, Notification, [](const auto ¬ification, 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)));} }) |