Skip to content

Commit

Permalink
Make DagWalk deterministic again
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus23 committed Aug 25, 2023
1 parent b3c51ae commit 28b3c26
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion car-mirror/src/dag_walk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl DagWalk {
// - skip Raw CIDs. They can't have further links (but needs adjustment to this function's return type)
// - run multiple `get_block` calls concurrently
let block = store.get_block(&cid).await?;
for ref_cid in references(cid, &block, HashSet::new())? {
for ref_cid in references(cid, &block, Vec::new())? {
if !self.visited.contains(&ref_cid) {
self.frontier.push_front(ref_cid);
}
Expand Down Expand Up @@ -132,6 +132,10 @@ mod tests {
async fn test_walk_dag_breadth_first() -> Result<()> {
let store = &MemoryBlockStore::new();

// cid_root ---> cid_1_wrap ---> cid_1
// -> cid_2
// -> cid_3

let cid_1 = store.put_serializable(&Ipld::String("1".into())).await?;
let cid_2 = store.put_serializable(&Ipld::String("2".into())).await?;
let cid_3 = store.put_serializable(&Ipld::String("3".into())).await?;
Expand Down

0 comments on commit 28b3c26

Please sign in to comment.