Skip to content

sync: collapse fetchBlockByRoots / fetchBlockByRootsFromPeer into single function #913

Description

@zclawz

Context

From PR #909 review (ch4r10t33r, item #5, partial).

PR #909 already collapsed the public ensureBlocksByRootRequest / ensureBlocksByRootRequestToPeer / ensureBlocksByRootRequestWithPeer into a single ensureBlocksByRootRequest(..., preferred_peer: ?[]const u8).

The same pattern exists at the BeamNode layer: fetchBlockByRoots and fetchBlockByRootsFromPeer are both private and could be collapsed into one function with an optional preferred_peer parameter. However, fetchBlockByRoots has 8+ call sites, so the refactor was deferred to avoid churn in the review cycle.

Proposal

Rename fetchBlockByRootsFromPeerfetchBlockByRoots with a preferred_peer: ?[]const u8 parameter and update all call sites to pass null where no preference exists.

Related: PR #909

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions