-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
let rlp = Rlp::new(&self.rlp); | ||
|
||
let mut header = Header { | ||
parent_hash: parent_hash, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future work: parent_hash
, uncle_hash
, difficulty
and number
can be calculated. We might want to flatten transaction trie as well and get rid of transactions_root
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uncles_hash
? really?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that the hash of the uncles RLP which can be calculated from the block uncle data?
|
||
// use initially 20MB for the reusable snappy buffers. | ||
// should always be larger than PREFERRED_CHUNK_SIZE for fault tolerance. | ||
const SNAPPY_BUFFER_SIZE: usize = 20 * 1024 * 1024; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider using snappy_max_compressed_length()
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
considering the buffer gets grown automatically if it is too small, it might just make sense to initially
allocate just max_compressed_len(16MB)
once we encode data to RLP, the overhead will often push it slightly over 16MB, so it may need growing once or twice, but this is unlikely.
Looks good in general |
adds some simple snappy bindings.
the blocks now don't contain any parent hash or number within them. Each chunk of blocks stores the parent hash and the number of the first contained within, and the rest can be recalculated.