2
0
mirror of https://github.com/Revertron/Alfis synced 2024-11-07 09:20:31 +00:00

Fixed panic when you try to mine genesis with existing origin hash in config.

This commit is contained in:
Revertron 2021-02-17 12:35:26 +01:00
parent c5bbf1b772
commit f28bedb8a1

View File

@ -136,8 +136,14 @@ impl Miner {
}
},
Some(block) => {
let index = block.index;
let mut context = context.lock().unwrap();
context.blockchain.add_block(block).expect("Error adding fresh mined block!");
if context.blockchain.add_block(block).is_err() {
println!("Error adding mined block!");
if index == 0 {
println!("To mine genesis block you need to make 'origin' an empty string in config.");
}
}
context.bus.post(Event::MinerStopped);
mining.store(false, Ordering::Relaxed);
},