diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/hash_chain.rs | 2 | ||||
| -rw-r--r-- | src/ui.rs | 20 |
2 files changed, 16 insertions, 6 deletions
diff --git a/src/hash_chain.rs b/src/hash_chain.rs index f21b1d2..e0ae1f2 100644 --- a/src/hash_chain.rs +++ b/src/hash_chain.rs @@ -53,7 +53,7 @@ impl<T: Encode> HashChain<T> { self.rehash(&base_hash); } - pub fn verify(&self, until_hash: &[u8]) -> bool { + pub fn verify(&self, until_hash: Vec<u8>) -> bool { let pos = self .data .iter() @@ -56,11 +56,21 @@ impl Ui { .get_blockchain() .clone() }; - println!( - "{:#?}", - bc.lock() - .await - ); + let bc = bc + .lock() + .await; + if let Some(cmd) = cmd.get(1) { + if *cmd == "verify" { + bc.verify( + bc.last() + .unwrap() + .0 + .clone(), + ); + } + } else { + println!("{:#?}", bc); + } } if cmd[0] == "peer" { |
