Getting ready for network broadcast
This commit is contained in:
@@ -2,7 +2,7 @@ use bft_json_crdt::json_crdt::{BaseCrdt, SignedOp};
|
||||
use fastcrypto::ed25519::Ed25519KeyPair;
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
use crate::crdt::TransactionList;
|
||||
use crate::{crdt::TransactionList, utils};
|
||||
|
||||
pub(crate) struct SideNode {
|
||||
crdt: BaseCrdt<TransactionList>,
|
||||
@@ -31,9 +31,13 @@ impl SideNode {
|
||||
println!("Starting node...");
|
||||
|
||||
loop {
|
||||
match self.stdin_receiver.try_recv() {
|
||||
match self.stdin_receiver.recv() {
|
||||
Ok(stdin) => {
|
||||
println!("Received stdin input: {:?}", stdin);
|
||||
let transaction = utils::fake_transaction(stdin);
|
||||
let json = serde_json::to_value(transaction).unwrap();
|
||||
let signed_op = self._add_transaction_local(json);
|
||||
self.send_to_network(signed_op);
|
||||
}
|
||||
Err(_) => {}
|
||||
}
|
||||
@@ -46,6 +50,10 @@ impl SideNode {
|
||||
}
|
||||
}
|
||||
|
||||
fn send_to_network(&self, signed_op: SignedOp) {
|
||||
println!("sending to network: {:?}", signed_op);
|
||||
}
|
||||
|
||||
fn handle_incoming(&mut self, incoming: &SignedOp) {
|
||||
println!("WINNNINGINGINGINGINGIGNIGN");
|
||||
self.crdt.apply(incoming.clone());
|
||||
|
||||
Reference in New Issue
Block a user