Fixing marking blocks as bad & SyncMessage bugs + small client refactoring. #503
Conversation
let bad_contains_parent = bad_blocks.contains(&header.parent_hash); | ||
|
||
let mark_block_as_bad = || { | ||
self.block_queue.write().unwrap().mark_as_bad(&header_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.
Is it really necessary to mark the blocks in queue in the loop? Could it be done like with mark_as_good(&[H256])
?
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.
Not necessary
NewChainBlock(Bytes), //TODO: use Cow | ||
NewChainBlocks { | ||
/// Hashes of blocks imported to blockchain | ||
good: Vec<H256>, |
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.
This will be (probably) needed by transaction queue.
@@ -285,18 +285,24 @@ impl BlockQueue { | |||
} | |||
|
|||
/// Mark given block and all its children as bad. Stops verification. | |||
pub fn mark_as_bad(&mut self, hash: &H256) { | |||
pub fn mark_as_bad(&mut self, hashes: &[H256]) { |
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.
should not clear what hashes
means in this context. consider renaming to bad_blocks
or bad_hashes
, if that's what is meant.
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.
Fixed, altough I renamed to block_hashes
(because we already have bad
in fn name), is it ok?
Conflicts: ethcore/src/client.rs
Fixing marking blocks as bad & SyncMessage bugs + small client refactoring.
No description provided.