fix flaky test, clean up specs

This commit is contained in:
keorn 2016-11-21 12:06:14 +00:00
parent 55a3da8f0a
commit c6db157554
3 changed files with 12 additions and 12 deletions

View File

@ -21,8 +21,8 @@
"genesis": { "genesis": {
"seal": { "seal": {
"generic": { "generic": {
"fields": 1, "fields": 2,
"rlp": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa" "rlp": "0x200"
} }
}, },
"difficulty": "0x20000", "difficulty": "0x20000",

View File

@ -11,9 +11,9 @@
}, },
"genesis": { "genesis": {
"seal": { "seal": {
"ethereum": { "generic": {
"nonce": "0x00006d6f7264656e", "fields": 0,
"mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578" "rlp": "0x0"
} }
}, },
"difficulty": "0x20000", "difficulty": "0x20000",

View File

@ -417,13 +417,13 @@ mod tests {
let engine = Spec::new_test_round().engine; let engine = Spec::new_test_round().engine;
let signature = tap.sign(addr, Some("0".into()), header.bare_hash()).unwrap(); let signature = tap.sign(addr, Some("0".into()), header.bare_hash()).unwrap();
let mut step = UNIX_EPOCH.elapsed().unwrap().as_secs(); let time = UNIX_EPOCH.elapsed().unwrap().as_secs();
// Two authorities.
let mut step = time - time % 2;
header.set_seal(vec![encode(&step).to_vec(), encode(&(&*signature as &[u8])).to_vec()]); header.set_seal(vec![encode(&step).to_vec(), encode(&(&*signature as &[u8])).to_vec()]);
let first_ok = engine.verify_block_seal(&header).is_ok(); assert!(engine.verify_block_seal(&header).is_err());
step = step + 1; step = step + 1;
header.set_seal(vec![encode(&step).to_vec(), encode(&(&*signature as &[u8])).to_vec()]); header.set_seal(vec![encode(&step).to_vec(), encode(&(&*signature as &[u8])).to_vec()]);
let second_ok = engine.verify_block_seal(&header).is_ok(); assert!(engine.verify_block_seal(&header).is_ok());
assert!(first_ok ^ second_ok);
} }
} }