new error proposal test
This commit is contained in:
parent
91099f62c9
commit
c8a3db4c52
@ -510,10 +510,10 @@ impl Engine for Tendermint {
|
|||||||
|
|
||||||
// Commit is longer than empty signature list.
|
// Commit is longer than empty signature list.
|
||||||
let parent_signature_len = parent.seal()[2].len();
|
let parent_signature_len = parent.seal()[2].len();
|
||||||
if parent_signature_len < 1 {
|
if parent_signature_len <= 1 {
|
||||||
try!(Err(EngineError::BadSealFieldSize(OutOfBounds {
|
try!(Err(EngineError::BadSealFieldSize(OutOfBounds {
|
||||||
// One signature.
|
// One signature.
|
||||||
min: Some(136),
|
min: Some(69),
|
||||||
max: None,
|
max: None,
|
||||||
found: parent_signature_len
|
found: parent_signature_len
|
||||||
})));
|
})));
|
||||||
@ -695,11 +695,10 @@ mod tests {
|
|||||||
let seal = proposal_seal(&tap, &header, 0);
|
let seal = proposal_seal(&tap, &header, 0);
|
||||||
header.set_seal(seal);
|
header.set_seal(seal);
|
||||||
// Good proposer.
|
// Good proposer.
|
||||||
assert!(engine.verify_block_unordered(&header, None).is_ok());
|
assert!(engine.verify_block_unordered(&header.clone(), None).is_ok());
|
||||||
|
|
||||||
let mut header = Header::default();
|
let validator = insert_and_unlock(&tap, "0");
|
||||||
let random = insert_and_unlock(&tap, "101");
|
header.set_author(validator);
|
||||||
header.set_author(random);
|
|
||||||
let seal = proposal_seal(&tap, &header, 0);
|
let seal = proposal_seal(&tap, &header, 0);
|
||||||
header.set_seal(seal);
|
header.set_seal(seal);
|
||||||
// Bad proposer.
|
// Bad proposer.
|
||||||
@ -707,6 +706,16 @@ mod tests {
|
|||||||
Err(Error::Engine(EngineError::NotProposer(_))) => {},
|
Err(Error::Engine(EngineError::NotProposer(_))) => {},
|
||||||
_ => panic!(),
|
_ => panic!(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let random = insert_and_unlock(&tap, "101");
|
||||||
|
header.set_author(random);
|
||||||
|
let seal = proposal_seal(&tap, &header, 0);
|
||||||
|
header.set_seal(seal);
|
||||||
|
// Not authority.
|
||||||
|
match engine.verify_block_unordered(&header, None) {
|
||||||
|
Err(Error::Engine(EngineError::NotAuthorized(_))) => {},
|
||||||
|
_ => panic!(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
Reference in New Issue
Block a user