block cleanup (#9117)

* blockchain insert expects owned block instead of block reference

* reduce a number of times a block is deserialized

* removed cached uncle_bytes from block

* removed is_finalized from OpenBlock

* removed unused parity_machine::WithMetadata trait

* removed commented out code

* remove unused metadata from block

* remove unused metadata from block

* BlockDetails extras may have at most 5 elements
This commit is contained in:
Marek Kotewicz
2018-07-30 11:45:10 +02:00
committed by André Silva
parent a809621f63
commit c54beba932
14 changed files with 179 additions and 273 deletions

View File

@@ -19,11 +19,11 @@
use std::collections::VecDeque;
use ethereum_types::{U256, H256, Bloom};
use bytes::Bytes;
use header::Header;
use rlp::encode;
use transaction::SignedTransaction;
use views::BlockView;
use encoded;
/// Helper structure, used for encoding blocks.
#[derive(Default, Clone, RlpEncodable)]
@@ -41,7 +41,7 @@ impl Block {
#[inline]
pub fn hash(&self) -> H256 {
view!(BlockView, &self.encoded()).header_view().hash()
view!(BlockView, &self.encoded().raw()).header_view().hash()
}
#[inline]
@@ -50,8 +50,8 @@ impl Block {
}
#[inline]
pub fn encoded(&self) -> Bytes {
encode(self).into_vec()
pub fn encoded(&self) -> encoded::Block {
encoded::Block::new(encode(self).into_vec())
}
#[inline]