Skip to content

IBD headers optimizations #631

Open
Open
@freshair18

Description

@freshair18

During IBD, headers are initially supplied to the node at the headers only stage, in order to determine the most advanced selected tip quickly.
The blocks download stage later asks for the full blocks. However currently the headers too are redownloaded despite already being available.

The reasoning for this is mostly due to simplicity and legacy logic from Bitcoin, where headers are incredibly small. In Kaspa the headers consist of multiple parents' hashes instead of 1, and moreso contain higher level parents' hashes as well. Headers are still small compared to body, but no longer negligibly small, resulting in a small but unnecessary elongation of IBD time and extra bandwidth consumption.

Optimization proposal

Implement a new p2p message to provide block body only, with structure roughly like:
struct block_body{ hash: Hash, txs: Vec<Transaction>, },

and have nodes receiving this message construct the block body on their own and match and verify it with the already available header.

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