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

Store Genesis Block Payload for view 1 #2453

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions crates/hotshot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,17 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>> SystemContext<TYPES, I> {
let mut saved_payloads = BTreeMap::new();
saved_leaves.insert(anchored_leaf.commit(), anchored_leaf.clone());
if let Some(payload) = anchored_leaf.get_block_payload() {
let encoded_txns = match payload.encode() {
let encoded_txns: Vec<u8> = match payload.encode() {
// TODO (Keyao) [VALIDATED_STATE] - Avoid collect/copy on the encoded transaction bytes.
// <https://github.com/EspressoSystems/HotShot/issues/2115>
Ok(encoded) => encoded.into_iter().collect(),
Err(e) => {
return Err(HotShotError::BlockError { source: e });
}
};
saved_payloads.insert(anchored_leaf.get_view_number(), encoded_txns);
saved_payloads.insert(anchored_leaf.get_view_number(), encoded_txns.clone());
// Insert the genesis block for the first view, that's what the first leader will propose
saved_payloads.insert(TYPES::Time::new(1), encoded_txns);
}

let start_view = anchored_leaf.get_view_number();
Expand Down
Loading