CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
25 namespace catapult {
namespace handlers {
28 template<
typename TRequest>
54 template<
typename TRequest>
58 auto pPacket = ionet::CreateSharedPacket<ionet::Packet>(payloadSize);
70 bool shouldAllowZeroHeight) {
71 const auto* pRequest = ionet::CoercePacket<TRequest>(&packet);
77 CATAPULT_LOG(trace) <<
"local height = " <<
info.ChainHeight <<
", request height = " << pRequest->Height;
78 if (
info.ChainHeight < pRequest->Height || (!shouldAllowZeroHeight &&
Height(0) == pRequest->Height)) {
83 info.NormalizedRequestHeight =
Height(0) == pRequest->Height ?
info.ChainHeight : pRequest->Height;
84 info.pRequest = pRequest;
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
A packet header with a data payload.
Definition: Packet.h:32
utils::BaseValue< uint64_t, Height_tag > Height
Definition: src/catapult/types.h:85
Height ChainHeight
Current chain height.
Definition: HeightRequestProcessor.h:37
A read only view on top of block storage.
Definition: BlockStorageCache.h:30
Information about a height request.
Definition: HeightRequestProcessor.h:29
const PacketPayload & response() const
Gets the response associated with this context.
Definition: PacketHandlers.cpp:46
static constexpr auto Packet_Type
Definition: RemoteNodeApi.cpp:33
def info(*args)
Definition: forwardsValidation.py:12
Height chainHeight() const
Gets the number of blocks.
Definition: BlockStorageCache.cpp:81
static HeightRequestInfo< TRequest > Process(const io::BlockStorageView &storage, const ionet::Packet &packet, ionet::ServerPacketHandlerContext &context, bool shouldAllowZeroHeight)
Definition: HeightRequestProcessor.h:66
uint32_t numAvailableBlocks() const
Gets the number of remaining blocks in the chain.
Definition: HeightRequestProcessor.h:48
const TRequest * pRequest
Coerced request.
Definition: HeightRequestProcessor.h:44
Height NormalizedRequestHeight
Definition: HeightRequestProcessor.h:41
Helper for processing height requests.
Definition: HeightRequestProcessor.h:55
constexpr HeightRequestInfo()
Creates a height request info.
Definition: HeightRequestProcessor.h:32
A packet payload that can be written.
Definition: PacketPayload.h:29
Definition: AddressExtractionExtension.cpp:28
static auto CreateResponsePacket(uint32_t payloadSize)
Definition: HeightRequestProcessor.h:57
Context passed to a server packet handler function.
Definition: PacketHandlers.h:32