Delete historical artifact
This was just to explain Proof of History. We have better explanations elsewhere. Delete!
This commit is contained in:
parent
3236be7877
commit
52f1a02938
|
@ -12,10 +12,6 @@ authors = [
|
||||||
]
|
]
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
|
|
||||||
[[bin]]
|
|
||||||
name = "solana-historian-demo"
|
|
||||||
path = "src/bin/historian-demo.rs"
|
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "solana-client-demo"
|
name = "solana-client-demo"
|
||||||
path = "src/bin/client-demo.rs"
|
path = "src/bin/client-demo.rs"
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
extern crate solana;
|
|
||||||
|
|
||||||
use solana::entry::Entry;
|
|
||||||
use solana::event::Event;
|
|
||||||
use solana::hash::Hash;
|
|
||||||
use solana::historian::Historian;
|
|
||||||
use solana::ledger::Block;
|
|
||||||
use solana::recorder::Signal;
|
|
||||||
use solana::signature::{KeyPair, KeyPairUtil};
|
|
||||||
use solana::transaction::Transaction;
|
|
||||||
use std::sync::mpsc::{sync_channel, SendError, SyncSender};
|
|
||||||
use std::thread::sleep;
|
|
||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
fn create_ledger(input: &SyncSender<Signal>, seed: &Hash) -> Result<(), SendError<Signal>> {
|
|
||||||
sleep(Duration::from_millis(15));
|
|
||||||
let keypair = KeyPair::new();
|
|
||||||
let tr = Transaction::new(&keypair, keypair.pubkey(), 42, *seed);
|
|
||||||
let signal0 = Signal::Event(Event::Transaction(tr));
|
|
||||||
input.send(signal0)?;
|
|
||||||
sleep(Duration::from_millis(10));
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let (input, event_receiver) = sync_channel(10);
|
|
||||||
let seed = Hash::default();
|
|
||||||
let hist = Historian::new(event_receiver, &seed, Some(10));
|
|
||||||
create_ledger(&input, &seed).expect("send error");
|
|
||||||
drop(input);
|
|
||||||
let entries: Vec<Entry> = hist.output.lock().unwrap().iter().collect();
|
|
||||||
for entry in &entries {
|
|
||||||
println!("{:?}", entry);
|
|
||||||
}
|
|
||||||
// Proof-of-History: Verify the historian learned about the events
|
|
||||||
// in the same order they appear in the vector.
|
|
||||||
assert!(entries[..].verify(&seed));
|
|
||||||
}
|
|
Loading…
Reference in New Issue