Tests for Client sealing.

This commit is contained in:
Gav Wood
2016-03-02 00:34:38 +01:00
parent 046b8e4704
commit 929f44fe4f
3 changed files with 29 additions and 3 deletions

View File

@@ -15,6 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
use client::{BlockChainClient, Client, ClientConfig, BlockId};
use block::IsBlock;
use tests::helpers::*;
use common::*;
use devtools::*;
@@ -106,3 +107,22 @@ fn can_collect_garbage() {
client.tick();
assert!(client.blockchain_cache_info().blocks < 100 * 1024);
}
#[test]
fn can_mine() {
let dummy_blocks = get_good_dummy_block_seq(2);
let client_result = get_test_client_with_blocks(vec![dummy_blocks[0].clone()]);
let client = client_result.reference();
let b = client.sealing_block();
let pow_hash = {
let u = b.lock().unwrap();
match *u {
Some(ref b) => {
assert_eq!(*b.block().header().parent_hash(), BlockView::new(&dummy_blocks[0]).header_view().sha3());
b.hash()
}
None => { panic!(); }
}
};
assert!(client.submit_seal(pow_hash, vec![]).is_ok());
}