mirror of
https://github.com/Revertron/Alfis
synced 2024-11-17 03:25:43 +00:00
Small fix in miner.
This commit is contained in:
parent
55a6a1e9c2
commit
decb430d82
@ -204,10 +204,11 @@ impl Miner {
|
|||||||
fn find_hash(context: Arc<Mutex<Context>>, digest: &mut dyn Digest, mut block: Block, running: Arc<AtomicBool>, top_block: Arc<AtomicU64>) -> Option<Block> {
|
fn find_hash(context: Arc<Mutex<Context>>, digest: &mut dyn Digest, mut block: Block, running: Arc<AtomicBool>, top_block: Arc<AtomicU64>) -> Option<Block> {
|
||||||
let mut buf: [u8; 32] = [0; 32];
|
let mut buf: [u8; 32] = [0; 32];
|
||||||
let difficulty = block.difficulty as usize;
|
let difficulty = block.difficulty as usize;
|
||||||
|
let full = block.transaction.is_some();
|
||||||
loop {
|
loop {
|
||||||
block.random = rand::random();
|
block.random = rand::random();
|
||||||
block.index = context.lock().unwrap().chain.height() + 1;
|
block.index = context.lock().unwrap().chain.height() + 1;
|
||||||
if context.lock().unwrap().chain.next_allowed_block() > block.index {
|
if full && context.lock().unwrap().chain.next_allowed_block() > block.index {
|
||||||
// We can't mine now, as we need to wait for block to be signed
|
// We can't mine now, as we need to wait for block to be signed
|
||||||
thread::sleep(Duration::from_millis(1000));
|
thread::sleep(Duration::from_millis(1000));
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user