Giving nodes the ability to send transactions in a more controlled fashion
This commit is contained in:
@@ -1,23 +1,8 @@
|
||||
/*
|
||||
|
||||
loop {
|
||||
let _ = list_transaction_crdt::send(count, bft_crdt, &mut ws, &keys).await;
|
||||
|
||||
let msg = ws.receive().await?;
|
||||
|
||||
// deserialize the received websocket Frame into a string
|
||||
let msg = msg.into_text().unwrap().0;
|
||||
|
||||
// deserialize the message into a Transaction struct
|
||||
let incoming_operation: SignedOp = serde_json::from_str(&msg).unwrap();
|
||||
|
||||
let author = general_purpose::STANDARD.encode(&incoming_operation.author());
|
||||
println!("Received from {:?}", author);
|
||||
|
||||
bft_crdt.apply(incoming_operation.clone());
|
||||
|
||||
count = count + 1;
|
||||
interval.tick().await;
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -28,7 +13,7 @@ use ezsockets::ClientConfig;
|
||||
use fastcrypto::ed25519::Ed25519KeyPair;
|
||||
use std::io::BufRead;
|
||||
|
||||
use crate::list_transaction_crdt::CrdtList;
|
||||
use crate::list_transaction_crdt::{self, CrdtList};
|
||||
|
||||
struct Client {}
|
||||
|
||||
@@ -63,7 +48,13 @@ pub(crate) async fn start(keys: Ed25519KeyPair, bft_crdt: &mut BaseCrdt<CrdtList
|
||||
let lines = stdin.lock().lines();
|
||||
for line in lines {
|
||||
let line = line.unwrap();
|
||||
tracing::info!("sending {line}");
|
||||
handle.text(line).unwrap();
|
||||
let signed_op = if let "exit" = line.as_str() {
|
||||
break;
|
||||
} else {
|
||||
let op = list_transaction_crdt::send(bft_crdt, &keys);
|
||||
op.to_string()
|
||||
};
|
||||
tracing::info!("sending {:?}", signed_op);
|
||||
handle.text(signed_op).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user