| catapult::observers::DEFINE_OBSERVER (HashLock, Notification, [](const auto ¬ification, ObserverContext &context) { auto &cache=context.Cache.sub< cache::HashLockInfoCache >();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));auto receiptType=model::Receipt_Type_LockHash_Created;model::BalanceChangeReceipt receipt(receiptType, notification.Signer, mosaicId, notification.Mosaic.Amount);context.StatementBuilder().addReceipt(receipt);} else { cache.remove(notification.Hash);} }) |