HathorNetwork / hathor-core

Hathor core is the official and reference client for operating a full node in Hathor Network.

Home Page:https://hathor.network

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sync-v2: "unexpected BLOCK" error

alexruzenhack opened this issue · comments

Reported in this on-call-incident: https://github.com/HathorNetwork/on-call-incidents/issues/141

The sync-v2 emits this error when receive handle_blocks call but the peer is not in syncing state.

    def handle_blocks(self, payload: str) -> None:
        """ Handle a BLOCKS message.
        """
        if self.state is not PeerState.SYNCING_BLOCKS:
            self.log.error('unexpected BLOCK', state=self.state)
            self.protocol.send_error_and_close_connection('Not expecting to receive BLOCK message')
            return

Jan's quote:

This is a bug on sync-v2, it should close the connection instead of only entering an ERROR state, I think we already discussed about entirely removing the ERROR state.

This is also happening to some other messages, like unexpected BLOCKS-END, just for the record.

This has been fixed.