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

Update block.rs for pending block #405

Merged
merged 3 commits into from
Dec 9, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/types/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct BlockHeader {
pub uncles_hash: H256,
/// Miner/author's address.
#[serde(rename = "miner")]
pub author: H160,
pub author: Option<H160>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's really weird that author/miner is not set, I can't find any evidence of this change. Since this is an edge case and I can imagine anyone really wanting to handle the None case, let's please use default value instead of Option.

Suggested change
pub author: Option<H160>,
#[serde(default)]
pub author: H160,

/// State root hash
#[serde(rename = "stateRoot")]
pub state_root: H256,
Expand Down Expand Up @@ -63,7 +63,7 @@ pub struct Block<TX> {
pub uncles_hash: H256,
/// Miner/author's address.
#[serde(rename = "miner")]
pub author: H160,
pub author: Option<H160>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub author: Option<H160>,
#[serde(default)]
pub author: H160,

/// State root hash
#[serde(rename = "stateRoot")]
pub state_root: H256,
Expand Down