User serde_json for SignedOp serialization

This commit is contained in:
Dave Hrycyszyn
2024-06-07 14:58:41 +01:00
parent 95e3127903
commit b1f5d2b75a
3 changed files with 4 additions and 10 deletions

View File

@@ -35,7 +35,7 @@ pub(crate) fn new(side_dir: PathBuf) -> (BaseCrdt<CrdtList>, Ed25519KeyPair) {
(bft_crdt, keys)
}
pub(crate) fn send(
pub(crate) fn create(
bft_crdt: &mut BaseCrdt<CrdtList>,
keys: &Ed25519KeyPair,
) -> bft_json_crdt::json_crdt::SignedOp {

View File

@@ -51,10 +51,10 @@ pub(crate) async fn start(keys: Ed25519KeyPair, bft_crdt: &mut BaseCrdt<CrdtList
let signed_op = if let "exit" = line.as_str() {
break;
} else {
let op = list_transaction_crdt::send(bft_crdt, &keys);
op.to_string()
list_transaction_crdt::create(bft_crdt, &keys)
};
tracing::info!("sending {:?}", signed_op);
handle.text(signed_op).unwrap();
let json = serde_json::to_string(&signed_op).unwrap();
handle.text(json).unwrap();
}
}