Skip to content

Commit

Permalink
Use send transaction instead of submit transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
elliedavidson committed Aug 8, 2023
1 parent 2af680c commit 4b1795d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,14 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>> SystemContext<TYPES::Consens
// Wrap up a message
// TODO place a view number here that makes sense
// we haven't worked out how this will work yet
let message = DataMessage::SubmitTransaction(transaction, TYPES::Time::new(0));
// let message = DataMessage::SubmitTransaction(transaction, TYPES::Time::new(0));

// self.inner.exchanges.committee_exchange().network.broadcast(message).await;

let api = self.clone();
async_spawn(async move {
let _result = self.inner.exchanges.committee_exchange().network.broadcast(message).await.is_err();
});
// let api = self.clone();
// async_spawn(async move {
// // let _result = self.inner.exchanges.committee_exchange().network.broadcast(message).await.is_err();
// });
Ok(())
}

Expand Down
33 changes: 27 additions & 6 deletions testing/src/txn_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ use hotshot_task::{
task_impls::{HSTWithEventAndMessage, TaskBuilder},
GeneratedStream,
};
use hotshot_types::message::DataMessage;
use hotshot_types::traits::node_implementation::NodeType;
use hotshot_types::message::SequencingMessage;
use hotshot::HotShotSequencingConsensusApi;
use hotshot_types::traits::node_implementation::NodeImplementation;
use hotshot_types::traits::node_implementation::SequencingExchangesType;
use hotshot_consensus::traits::SequencingConsensusApi;
use hotshot_types::traits::state::ConsensusTime;
use hotshot_types::traits::consensus_type::sequencing_consensus::SequencingConsensus;
use hotshot_types::message::Message;
use rand::thread_rng;
use snafu::Snafu;
use std::{sync::Arc, time::Duration};
Expand Down Expand Up @@ -62,7 +71,13 @@ impl TxnTaskDescription {
/// build a task
pub fn build<TYPES: NodeType, I: TestableNodeImplementation<TYPES::ConsensusType, TYPES>>(
self,
) -> TaskGenerator<TxnTask<TYPES, I>> {
) -> TaskGenerator<TxnTask<TYPES, I>>
where
TYPES: NodeType<ConsensusType = SequencingConsensus>,
<I as NodeImplementation<TYPES>>::Exchanges:
SequencingExchangesType<TYPES, Message<TYPES, I>>,
I: NodeImplementation<TYPES, ConsensusMessage = SequencingMessage<TYPES, I>>,
{
Box::new(move |state, mut registry, test_event_stream| {
async move {
// consistency check
Expand Down Expand Up @@ -111,11 +126,17 @@ impl TxnTaskDescription {
&mut thread_rng(),
0,
);
node.handle
.submit_transaction(txn.clone())
.await
.expect("Could not send transaction");
(None, state)
// ED Shouldn't create this each time
let api = HotShotSequencingConsensusApi {
inner: node.handle.hotshot.inner.clone(),
};
api.send_transaction(DataMessage::SubmitTransaction(
txn.clone(),
TYPES::Time::new(0),
))
.await
.expect("Could not send transaction");
return (None, state);
}
}
} else {
Expand Down

0 comments on commit 4b1795d

Please sign in to comment.