Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Aleth disables peer when receiving NewBlockHashes packet containing more hashes than Aleth's internal max #5677

@halfalicious

Description

@halfalicious

When Aleth receives a NewBlockHashes packet which contains more hashes than c_maxIncomingNewHashes, Aleth disables the peer rather than processing the first c_maxIncomingNewHashes:

case NewBlockHashesPacket:
{
unsigned itemCount = _r.itemCount();
LOG(m_logger) << "BlockHashes (" << dec << itemCount << " entries) "
<< (itemCount ? "" : " : NoMoreHashes") << " from " << _peerID;
if (itemCount > c_maxIncomingNewHashes)
{
disablePeer(_peerID, "Too many new hashes");
break;
}

Note that Parity processes the first MAX_NEW_HASHES hashes: https://github.com/paritytech/parity-ethereum/blob/master/ethcore/sync/src/chain/handler.rs#L219-L288

I think the Parity behavior makes sense since other clients can have different max hash counts and therefore we cannot count on them knowing what our limit is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions