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

Namespaces

 catapult
 
 catapult::observers
 

Functions

 catapult::observers::DEFINE_OBSERVER (HashLock, Notification, [](const auto &notification, 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);} })