Skip to content

fix(p2p): correlate NOTIFY responses with prior requests; cap flash heights#198

Open
raw391 wants to merge 1 commit into
Beldex-Coin:devfrom
raw391:fix/p2p-response-correlation-gate
Open

fix(p2p): correlate NOTIFY responses with prior requests; cap flash heights#198
raw391 wants to merge 1 commit into
Beldex-Coin:devfrom
raw391:fix/p2p-response-correlation-gate

Conversation

@raw391

@raw391 raw391 commented Jun 4, 2026

Copy link
Copy Markdown

Four NOTIFY handlers in cryptonote_protocol_handler.inl accept incoming messages without verifying correlation against pending requests. handle_response_get_blocks at line 1216 derefs context.m_last_request_time without checking it; an unsolicited NOTIFY_RESPONSE_GET_BLOCKS reaches that line and crashes the daemon. Siblings handle_response_chain_entry (line 2426) and handle_response_block_flashes (line 2513) accept unsolicited responses; handle_request_block_flashes (line 2500) has no heights cap.

Patch adds per-request correlation tokens: m_requested_objects (existing field) for GET_BLOCKS and CHAIN_ENTRY (non-empty and empty respectively, since a chain response should not consume a pending block-response timer), new m_requested_flash_heights field on connection_context populated at the request send-site for BLOCK_FLASHES, and a heights cap reusing CURRENCY_PROTOCOL_MAX_OBJECT_REQUEST_COUNT for the flash request handler.

…eights

Four NOTIFY handlers in cryptonote_protocol_handler.inl accept incoming
messages without verifying correlation against pending requests.
handle_response_get_blocks at line 1216 derefs context.m_last_request_time
without checking it; an unsolicited NOTIFY_RESPONSE_GET_BLOCKS reaches
that line and crashes the daemon.

Adds per-request correlation tokens:
- m_requested_objects (existing) for GET_BLOCKS (must be non-empty)
- m_requested_objects (existing) for CHAIN_ENTRY (must be empty; chain
  responses do not consume a pending block-response timer)
- new m_requested_flash_heights field on connection_context populated
  at the NOTIFY_REQUEST_BLOCK_FLASHES send-site for BLOCK_FLASHES
  responses
- CURRENCY_PROTOCOL_MAX_OBJECT_REQUEST_COUNT cap on
  NOTIFY_REQUEST_BLOCK_FLASHES heights
@raw391 raw391 force-pushed the fix/p2p-response-correlation-gate branch from 77a30a3 to 27d94d9 Compare June 5, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants