Added additional material for consensus.
This commit is contained in:
@@ -73,8 +73,11 @@ impl Block {
|
|||||||
if self.transaction.is_some() && other.transaction.is_none() {
|
if self.transaction.is_some() && other.transaction.is_none() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
let my_diff = hash_difficulty(self.hash.as_slice()) + key_hash_difficulty(self.hash.as_slice());
|
let hash_diff = hash_difficulty(self.hash.as_slice()) + key_hash_difficulty(self.hash.as_slice());
|
||||||
let it_diff = hash_difficulty(other.hash.as_slice()) + key_hash_difficulty(other.hash.as_slice());
|
let my_diff = (hash_diff << 16) + (self.hash.get_tail_u64() % 0xFFFF) as u32;
|
||||||
|
let hash_diff = hash_difficulty(other.hash.as_slice()) + key_hash_difficulty(other.hash.as_slice());
|
||||||
|
let it_diff = (hash_diff << 16) + (other.hash.get_tail_u64() % 0xFFFF) as u32;
|
||||||
|
|
||||||
if my_diff > it_diff {
|
if my_diff > it_diff {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -580,6 +580,8 @@ fn handle_block(context: Arc<Mutex<Context>>, peers: &mut Peers, token: &Token,
|
|||||||
if zone {
|
if zone {
|
||||||
context.bus.post(crate::event::Event::ZonesChanged);
|
context.bus.post(crate::event::Event::ZonesChanged);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
debug!("Fork in not better than our block, dropping.");
|
||||||
}
|
}
|
||||||
let height = context.chain.get_height();
|
let height = context.chain.get_height();
|
||||||
context.chain.update_max_height(height);
|
context.chain.update_max_height(height);
|
||||||
|
|||||||
Reference in New Issue
Block a user