Removed redundant struct bounds and unnecessary data copying#9096
Conversation
| fn block(&self) -> &ExecutedBlock { &self.block } | ||
| } | ||
|
|
||
| impl<'x> IsBlock for ClosedBlock { |
| } | ||
|
|
||
| fn check_and_close_block(&self, block: PreverifiedBlock, client: &Client) -> Result<LockedBlock, ()> { | ||
| fn check_and_lock_block(&self, block: PreverifiedBlock, client: &Client) -> Result<LockedBlock, ()> { |
There was a problem hiding this comment.
renamed, cause the function returns LockedBlock, not ClosedBlock
|
|
||
| // Commit results | ||
| let receipts = block.receipts().to_owned(); | ||
| let traces = block.traces().clone().drain(); |
There was a problem hiding this comment.
receipts and traces were copied
| /// Special queue-like datastructure that includes the notion of | ||
| /// usage to avoid items that were queued but never used from making it into | ||
| /// the queue. | ||
| pub struct UsingQueue<T> where T: Clone { |
There was a problem hiding this comment.
redundant struct bounds
dvdplm
left a comment
There was a problem hiding this comment.
Code lgtm, minor doc grumbles.
| //! Blockchain block. | ||
| //! Base data structure of this module is `Block`. | ||
| //! | ||
| //! Blocks can be produced by a local node or they may be received from network. |
| //! Blocks can be produced by a local node or they may be received from network. | ||
| //! | ||
| //! To create a block locally, we start with an `OpenBlock`. This block is mutable | ||
| //! and can be appended with transactions and uncles. |
There was a problem hiding this comment.
"…can be appended to with transactions and uncles".
| //! To create a block locally, we start with an `OpenBlock`. This block is mutable | ||
| //! and can be appended with transactions and uncles. | ||
| //! | ||
| //! When ready, `OpenBlock` can be closed and turned into `ClosedBlock`. `ClosedBlock` can |
There was a problem hiding this comment.
"…turned into a ClosedBlock. A ClosedBlock can…"
| //! and can be appended with transactions and uncles. | ||
| //! | ||
| //! When ready, `OpenBlock` can be closed and turned into `ClosedBlock`. `ClosedBlock` can | ||
| //! be reopend again by miner under certain circumstances. On block close, state commit is |
| } | ||
|
|
||
| /// Trait for a object that has a state database. | ||
| /// Trait for a object that owns an `ExecutedBlock` |
| @@ -599,8 +617,8 @@ impl SealedBlock { | |||
|
|
|||
| impl Drain for SealedBlock { | |||
| /// Drop this object and return the underlieing database. | |||
There was a problem hiding this comment.
"…underlying database"
Also: is it true that it's a "database" being returned with this change?
| let metadata = block.block().metadata().map(Into::into); | ||
| let is_finalized = block.block().is_finalized(); | ||
| let metadata = block.metadata; | ||
| let is_finalized = block.is_finalized; |
There was a problem hiding this comment.
Do you really need to make new bindings like this? Maybe it's more readable to see block.is_finalized further down the code, makes it obvious where it's coming from if one reads only parts of the method?
dvdplm
left a comment
There was a problem hiding this comment.
lgtm, and thanks for the added docs, most helpful!
| //! Blocks can be produced by a local node or they may be received from the network. | ||
| //! | ||
| //! To create a block locally, we start with an `OpenBlock`. This block is mutable | ||
| //! and can be appended to with transactions and uncles. |
There was a problem hiding this comment.
can be appended to with transactions and uncles.
There was a problem hiding this comment.
No this is correct, "She appended an item to the list using a magnet" => "The list was appended to with a magnet"
| //! and can be appended to with transactions and uncles. | ||
| //! | ||
| //! When ready, `OpenBlock` can be closed and turned into a `ClosedBlock`. A `ClosedBlock` can | ||
| //! be reopend again by a miner under certain circumstances. On block close, state commit is |
No description provided.