Class ProtocolHelloHandler
PROTOCOL_HELLO opcode introduced in
BLK-2026-04-22-007 Day 1.
When a peer sends PROTOCOL_HELLO with its advertised
HelloPayload, this handler runs the bidirectional version
compatibility check through ProtocolNegotiator. Success: the peer's
negotiated protocol version + feature bitmap are stamped on the
ConnectionContext and a PROTOCOL_HELLO_ACK response is
returned carrying this build's own HelloPayload so the initiator can
validate symmetrically. Failure: a RESPONSE_ERROR is returned with an
actionable message and the connection is left open — the caller decides
whether to close based on policy (strict vs. permissive).
This handler is invoked only after the frame has passed
MessageCodec decoding, so it cannot downgrade or adapt older wire
versions. Legacy peers keep working only if they already speak the same
MessageCodec.PROTOCOL_VERSION and simply omit HELLO.
Thread-safety: stateless. Safe to invoke from any handler thread.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionhandle(Message request, ConnectionContext sender) Handle an incomingPROTOCOL_HELLOrequest.
-
Constructor Details
-
ProtocolHelloHandler
- Parameters:
localFeatures- the features this build advertises (non-null, may be empty)
-
-
Method Details
-
handle
Handle an incomingPROTOCOL_HELLOrequest.- Parameters:
request- the request message (non-null, opcode must be PROTOCOL_HELLO)sender- the originating connection — stamped with negotiated metadata on success- Returns:
- a
PROTOCOL_HELLO_ACKon success orRESPONSE_ERRORon failure
-