Skip to content

fix(blockchain): handle SystemTime error without using ? operator in block producer #3647

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 9 additions & 1 deletion crates/blockchain/dev/block_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,16 @@ pub async fn start_block_producer(
finalized_block_hash: head_block_hash,
};

let timestamp = match SystemTime::now().duration_since(UNIX_EPOCH) {
Ok(duration) => duration.as_secs(),
Err(e) => {
return Err(EngineClientError::SystemFailed(format!(
"SystemTime error: {e}"
)));
}
};
let payload_attributes = PayloadAttributesV3 {
timestamp: SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs(),
timestamp,
prev_randao: H256::zero(),
suggested_fee_recipient: coinbase_address,
parent_beacon_block_root: Some(parent_beacon_block_root),
Expand Down
Loading