Fixed panic when you try to mine genesis with existing origin hash in config.
This commit is contained in:
+7
-1
@@ -136,8 +136,14 @@ impl Miner {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
Some(block) => {
|
Some(block) => {
|
||||||
|
let index = block.index;
|
||||||
let mut context = context.lock().unwrap();
|
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);
|
context.bus.post(Event::MinerStopped);
|
||||||
mining.store(false, Ordering::Relaxed);
|
mining.store(false, Ordering::Relaxed);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user