Skip to content

Commit

Permalink
fix: reconciliate main
Browse files Browse the repository at this point in the history
  • Loading branch information
lgalabru committed Feb 17, 2025
1 parent 1e95232 commit 24be23b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions crates/core/src/rpc/full.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::utils::{decode_and_deserialize, transform_tx_metadata_to_ui_accounts};
use crate::simnet::{EntryStatus, TransactionWithStatusMeta};
use crate::types::TransactionStatusEvent;
use super::utils::{decode_and_deserialize, transform_tx_metadata_to_ui_accounts};
use itertools::Itertools;
use jsonrpc_core::futures::future::{self, join_all};
use jsonrpc_core::BoxFuture;
Expand Down Expand Up @@ -938,12 +938,14 @@ mod tests {
.unwrap();

match mempool_rx.recv() {
Ok((_hash, _tx, status_tx)) => {
Ok(SimnetCommand::TransactionReceived(_, _, status_tx, _)) => {
status_tx
.send(TransactionConfirmationStatus::Confirmed)
.send(TransactionStatusEvent::Success(
TransactionConfirmationStatus::Confirmed,
))
.unwrap();
}
Err(_) => panic!("failed to receive transaction from mempool"),
_ => panic!("failed to receive transaction from mempool"),
}

assert_eq!(
Expand Down
18 changes: 7 additions & 11 deletions crates/core/src/test_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use solana_transaction_status::TransactionConfirmationStatus;
use crate::{
rpc::RunloopContext,
simnet::{EntryStatus, GlobalState, TransactionWithStatusMeta},
types::SimnetCommand,
};

pub struct TestSetup<T> {
Expand All @@ -26,7 +27,8 @@ pub struct TestSetup<T> {

impl<T> TestSetup<T> {
pub fn new(rpc: T) -> Self {
let (mempool_tx, _rx) = crossbeam_channel::unbounded();
let (simnet_commands_tx, _rx) = crossbeam_channel::unbounded();
let (plugin_manager_commands_tx, _rx) = crossbeam_channel::unbounded();

let mut svm = LiteSVM::new();
let clock = Clock {
Expand All @@ -40,7 +42,8 @@ impl<T> TestSetup<T> {

TestSetup {
context: RunloopContext {
mempool_tx,
simnet_commands_tx,
plugin_manager_commands_tx,
id: Hash::new_unique(),
state: Arc::new(RwLock::new(GlobalState {
svm,
Expand Down Expand Up @@ -74,16 +77,9 @@ impl<T> TestSetup<T> {
setup
}

pub fn new_with_mempool(
rpc: T,
mempool_tx: Sender<(
Hash,
VersionedTransaction,
Sender<TransactionConfirmationStatus>,
)>,
) -> Self {
pub fn new_with_mempool(rpc: T, simnet_commands_tx: Sender<SimnetCommand>) -> Self {
let mut setup = TestSetup::new(rpc);
setup.context.mempool_tx = mempool_tx;
setup.context.simnet_commands_tx = simnet_commands_tx;
setup
}

Expand Down

0 comments on commit 24be23b

Please sign in to comment.