When the cuckoo size is reduced for tests, pow needs to be recomputed for the genesis block.
This commit is contained in:
+1
-1
@@ -52,7 +52,7 @@ impl Tip {
|
||||
height: b.header.height,
|
||||
last_block_h: b.hash(),
|
||||
prev_block_h: b.header.previous,
|
||||
total_difficulty: b.header.total_difficulty.clone() + Difficulty::from_hash(&b.hash()),
|
||||
total_difficulty: b.header.total_difficulty.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -96,7 +96,6 @@ impl Server {
|
||||
let handle = evtlp.handle();
|
||||
evtlp.run(server.start(handle.clone())).unwrap();
|
||||
|
||||
|
||||
warn!("Grin server started.");
|
||||
Ok(Server {
|
||||
config: config,
|
||||
@@ -173,6 +172,8 @@ fn store_head(config: &ServerConfig)
|
||||
let mut gen = core::genesis::genesis();
|
||||
if config.cuckoo_size > 0 {
|
||||
gen.header.cuckoo_len = config.cuckoo_size;
|
||||
let diff = gen.header.difficulty.clone();
|
||||
core::pow::pow(&mut gen, diff).unwrap();
|
||||
}
|
||||
try!(chain_store.save_block(&gen).map_err(&Error::StoreErr));
|
||||
let tip = chain::types::Tip::new(gen.hash());
|
||||
|
||||
@@ -77,7 +77,8 @@ fn change<'a>(s: &'a grin::Server) -> HeadChange<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Future that monitors when a server has had its head updated.
|
||||
/// Future that monitors when a server has had its head updated. Current
|
||||
/// implementation isn't optimized, only use for tests.
|
||||
struct HeadChange<'a> {
|
||||
server: &'a grin::Server,
|
||||
original: chain::Tip,
|
||||
|
||||
Reference in New Issue
Block a user