libbitcoin / libbitcoin-network

Bitcoin P2P Network Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fail connection in receipt of unsubscribed message.

evoskuil opened this issue · comments

Given the current design:

  • Protocols should register for all message types that the session will solicit or that may be sent by peers unsolicited.
  • The start handler should block until initial protocols are registered (see related issue).
  • Any post-handshake solicitation should register subscription prior to sending the solicitation and deregister if and when the solicitation is expired.

any message that is received without a registered handler is in violation of the session's intended protocol and should result in channel stop. Otherwise DOS based on sending large unhandled messages is unchecked.

A session could devise other DOS protections, such as channel lifetime or byte limits so this feature should be enabled at proxy construct.

This is complicated by the fact that subscribers are removed from the subscription list during processing.