eth_getwork implemented.

This commit is contained in:
Gav Wood
2016-02-29 19:30:13 +01:00
parent 2c32b0fc1c
commit ffc5c2ea7b
9 changed files with 78 additions and 14 deletions

View File

@@ -172,7 +172,8 @@ fn get_data_size(block_number: u64) -> usize {
}
#[inline]
fn get_seedhash(block_number: u64) -> H256 {
/// Given the `block_number`, determine the seed hash for Ethash.
pub fn get_seedhash(block_number: u64) -> H256 {
let epochs = block_number / ETHASH_EPOCH_LENGTH;
let mut ret: H256 = [0u8; 32];
for _ in 0..epochs {

View File

@@ -24,7 +24,7 @@ mod compute;
use std::mem;
use compute::Light;
pub use compute::{quick_get_difficulty, H256, ProofOfWork, ETHASH_EPOCH_LENGTH};
pub use compute::{get_seedhash, quick_get_difficulty, H256, ProofOfWork, ETHASH_EPOCH_LENGTH};
use std::sync::{Arc, Mutex};
@@ -35,7 +35,7 @@ struct LightCache {
prev: Option<Arc<Light>>,
}
/// Lighy/Full cache manager
/// Light/Full cache manager.
pub struct EthashManager {
cache: Mutex<LightCache>,
}