Added additional material for consensus.

pull/99/head
Revertron 3 years ago
parent a4d9a64989
commit 6d4dfb282f

@ -73,8 +73,11 @@ impl Block {
if self.transaction.is_some() && other.transaction.is_none() {
return true;
}
let my_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 hash_diff = hash_difficulty(self.hash.as_slice()) + key_hash_difficulty(self.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 {
return true;
}

@ -580,6 +580,8 @@ fn handle_block(context: Arc<Mutex<Context>>, peers: &mut Peers, token: &Token,
if zone {
context.bus.post(crate::event::Event::ZonesChanged);
}
} else {
debug!("Fork in not better than our block, dropping.");
}
let height = context.chain.get_height();
context.chain.update_max_height(height);

Loading…
Cancel
Save