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.

Only perform DAO hard fork challenge if Aleth's top block is >= DAO hard fork block #5579

@halfalicious

Description

@halfalicious

Aleth contains a DAO hard fork challenge which it issues to potential peers in order to avoid wasting time syncing to ETC nodes. Additional details on the motivation for this challenge are described here: #5540 (comment)

The way the challenge works is that Aleth requests the DAO hard fork block from a potential peer and validates the extradata section of the block. If the peer is an ETC node, the hard fork block won't contain the expected extradata data and Aleth will avoid peering with the node.

The block is requested here:

// Before starting to exchange the data with the node, let's verify that it's on our chain
if (!requestDaoForkBlockHeader(_peer.id()))
{
// DAO challenge not needed
syncPeer(_peer.id(), false);
}

The challenge is verified in BlockChainSync::onPeerBlockHeaders:

if (m_daoChallengedPeers.find(_peerID) != m_daoChallengedPeers.end())
{
if (verifyDaoChallengeResponse(_r))
syncPeer(_peerID, false);
else
m_host.disablePeer(_peerID, "Peer from another fork.");
m_daoChallengedPeers.erase(_peerID);
return;
}

However, this challenge prevents us from syncing blocks with ETC nodes from before the DAO hard fork block. An optimization would be to only perform the DAO hard fork challenge if our top block is >= the DAO hard fork block (1920000).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions