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.