Optimized signing blocks scheduler.

This commit is contained in:
Revertron
2021-04-19 21:19:00 +02:00
parent 2680a7da70
commit 04ef49764a
5 changed files with 18 additions and 24 deletions
-8
View File
@@ -492,10 +492,6 @@ fn process_new_block(context: Arc<Mutex<Context>>, peers: &mut Peers, token: &To
match context.chain.check_new_block(&block) {
BlockQuality::Good => {
context.chain.add_block(block);
let keystore = context.keystore.clone();
if let Some(event) = context.chain.update(&keystore) {
context.bus.post(event);
}
let my_height = context.chain.height();
context.bus.post(crate::event::Event::BlockchainChanged { index: my_height });
// If it was the last block to sync
@@ -521,10 +517,6 @@ fn process_new_block(context: Arc<Mutex<Context>>, peers: &mut Peers, token: &To
let last_block = context.chain.last_block().unwrap();
if block.is_better_than(&last_block) {
context.chain.replace_block(block.index, block).expect("Error replacing block with fork");
let keystore = context.keystore.clone();
if let Some(event) = context.chain.update(&keystore) {
context.bus.post(event);
}
let index = context.chain.height();
context.bus.post(crate::event::Event::BlockchainChanged { index });
}