Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
LLFourn opened this issue May 28, 2023 · 0 comments · Fixed by #1034
Closed

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

LLFourn opened this issue May 28, 2023 · 0 comments · Fixed by #1034
Milestone

Comments

@LLFourn
Copy link
Contributor

LLFourn commented May 28, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
2 participants