Giving nodes the ability to send transactions in a more controlled fashion
This commit is contained in:
@@ -35,14 +35,12 @@ pub(crate) fn new(side_dir: PathBuf) -> (BaseCrdt<CrdtList>, Ed25519KeyPair) {
|
||||
(bft_crdt, keys)
|
||||
}
|
||||
|
||||
pub(crate) async fn send(
|
||||
count: u32,
|
||||
pub(crate) fn send(
|
||||
bft_crdt: &mut BaseCrdt<CrdtList>,
|
||||
// ws: &mut WebSocket,
|
||||
keys: &Ed25519KeyPair,
|
||||
) {
|
||||
) -> bft_json_crdt::json_crdt::SignedOp {
|
||||
// generate a placeholder transaction
|
||||
let transaction = generate_transaction(count, keys.public().to_string());
|
||||
let transaction = generate_transaction(keys.public().to_string());
|
||||
|
||||
// next job is to keep adding to this guy
|
||||
let next = bft_crdt.doc.list.ops.len();
|
||||
@@ -51,16 +49,13 @@ pub(crate) async fn send(
|
||||
.list
|
||||
.insert_idx(next - 1, transaction.clone())
|
||||
.sign(&keys);
|
||||
|
||||
// Ok(ws
|
||||
// .send_text(serde_json::to_string(&signed_op).unwrap())
|
||||
// .await?)
|
||||
signed_op
|
||||
}
|
||||
|
||||
fn generate_transaction(count: u32, pubkey: String) -> Value {
|
||||
fn generate_transaction(pubkey: String) -> Value {
|
||||
json!({
|
||||
"from": pubkey,
|
||||
"to": "Bob",
|
||||
"amount": count
|
||||
"amount": 1
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user