User serde_json for SignedOp serialization
This commit is contained in:
@@ -123,12 +123,6 @@ pub struct SignedOp {
|
||||
pub depends_on: Vec<SignedDigest>,
|
||||
}
|
||||
|
||||
impl Display for SignedOp {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "SignedOp({})", self)
|
||||
}
|
||||
}
|
||||
|
||||
impl SignedOp {
|
||||
pub fn id(&self) -> OpId {
|
||||
self.inner.id
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user