mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
Add test for switch commit consistency (#219)
This commit is contained in:
parent
283b846243
commit
914810713d
1 changed files with 20 additions and 0 deletions
|
@ -675,4 +675,24 @@ mod test {
|
|||
None => {}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn commit_consistency(){
|
||||
let keychain = Keychain::from_seed(&[0;32]).unwrap();
|
||||
let key_id = keychain.derive_key_id(1).unwrap();
|
||||
|
||||
let commit = keychain.commit(1003, &key_id).unwrap();
|
||||
let switch_commit = keychain.switch_commit(&key_id).unwrap();
|
||||
println!("Switch commit: {:?}", switch_commit);
|
||||
println!("commit: {:?}", commit);
|
||||
let key_id = keychain.derive_key_id(1).unwrap();
|
||||
|
||||
let switch_commit_2 = keychain.switch_commit(&key_id).unwrap();
|
||||
let commit_2 = keychain.commit(1003, &key_id).unwrap();
|
||||
println!("Switch commit 2: {:?}", switch_commit_2);
|
||||
println!("commit2 : {:?}", commit_2);
|
||||
|
||||
assert!(commit==commit_2);
|
||||
assert!(switch_commit==switch_commit_2);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue