Skip to content

LocalChain should be implemented as a cheaply cloneable singly linked list #997

@LLFourn

Description

@LLFourn

See bad ergonomics here:

let c = chain
.blocks()
.iter()
.rev()
.take(ASSUME_FINAL_DEPTH)
.map(|(k, v)| (*k, *v))
.collect::<BTreeMap<u32, BlockHash>>();

We should just be able to cheaply clone the whole thing (without copying all the data using referencing counting and linked list). From this you should be able to get an owned iterator of BlockId.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions