Skip to content

Commit

Permalink
write candidate receipts as well
Browse files Browse the repository at this point in the history
  • Loading branch information
ordian committed Sep 12, 2022
1 parent 9921b5f commit 08f75c8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion node/core/av-store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ async fn process_new_head<Context>(

// TODO: consider supplying the backing group as an optimization
let candidate_hash = receipt.hash();
let receipt_clone = receipt.clone();
ctx.send_unbounded_message(AvailabilityRecoveryMessage::RecoverAvailableData(
receipt,
session_index,
Expand Down Expand Up @@ -750,7 +751,18 @@ async fn process_new_head<Context>(
target: REQUESTER_LOG_TARGET,
?candidate_hash,
?error,
"Failed to create or write to a file",
"Failed to write available data",
);
};
let receipts_dir = std::path::Path::new(&out).join("receipts");
let _ = std::fs::create_dir_all(&receipts_dir);
let path = receipts_dir.join(&candidate_filename);
if let Err(error) = std::fs::write(path, receipt_clone.encode()) {
gum::warn!(
target: REQUESTER_LOG_TARGET,
?candidate_hash,
?error,
"Failed to write a receipt",
);
};
};
Expand Down

0 comments on commit 08f75c8

Please sign in to comment.