Skip to content

Commit

Permalink
Mempool syncer: fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Eligioo committed Dec 10, 2024
1 parent 0a950b9 commit 0bc22d5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
3 changes: 1 addition & 2 deletions mempool/src/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ use nimiq_network_interface::{
peer_info::Services,
request::{request_handler, RequestError},
};
use nimiq_time::sleep_until;
use nimiq_time::{sleep_until, Sleep};
use nimiq_transaction::{historic_transaction::RawTransactionHash, Transaction};
use nimiq_utils::{spawn, stream::FuturesUnordered};
use parking_lot::RwLock;
use tokio::time::Sleep;
use tokio_stream::wrappers::BroadcastStream;

use crate::{executor::PubsubIdOrPeerId, mempool_state::MempoolState};
Expand Down
14 changes: 8 additions & 6 deletions mempool/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2051,14 +2051,15 @@ async fn assert_rebase_invalidates_mempool_tx(tx1: Transaction, tx2: Transaction
let temp_producer2 = TemporaryBlockProducer::new();
assert_eq!(temp_producer2.push(block), Ok(PushResult::Extended));

let mut hub = MockHub::new();
let mock_id = MockId::new(hub.new_address().into());
let mock_network = Arc::new(hub.new_network());
// Create mempool and subscribe with a custom txn stream.
let mempool = Mempool::new(
Arc::clone(&temp_producer1.blockchain),
MempoolConfig::default(),
Arc::clone(&mock_network),
);
let mut hub = MockHub::new();
let mock_id = MockId::new(hub.new_address().into());
let mock_network = Arc::new(hub.new_network());

// Include tx1 in block1
let block1 = temp_producer1.next_block_with_txs(vec![], false, vec![tx1.clone()]);
Expand Down Expand Up @@ -2088,14 +2089,15 @@ async fn assert_rebase_invalidates_mempool_tx(tx1: Transaction, tx2: Transaction
async fn mempool_update_rebase_earlier_time() {
let temp_producer1 = TemporaryBlockProducer::new();

let mut hub = MockHub::new();
let mock_id = MockId::new(hub.new_address().into());
let mock_network = Arc::new(hub.new_network());
// Create mempool and subscribe with a custom txn stream.
let mempool = Mempool::new(
Arc::clone(&temp_producer1.blockchain),
MempoolConfig::default(),
Arc::clone(&mock_network),
);
let mut hub = MockHub::new();
let mock_id = MockId::new(hub.new_address().into());
let mock_network = Arc::new(hub.new_network());

// Create vesting and redeeming txs
let key_pair = ed25519_key_pair(ACCOUNT_SECRET_KEY);
Expand Down
7 changes: 2 additions & 5 deletions test-utils/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@ use std::sync::Arc;

use nimiq_blockchain::Blockchain;
use nimiq_blockchain_proxy::BlockchainProxy;
use nimiq_bls::cache::PublicKeyCache;
use nimiq_consensus::{
sync::syncer_proxy::SyncerProxy, BlsCache, Consensus, ConsensusEvent, ConsensusProxy,
};
use nimiq_consensus::{sync::syncer_proxy::SyncerProxy, BlsCache, Consensus};
use nimiq_network_interface::network::Network;
use nimiq_zkp_component::ZKPComponent;
use parking_lot::{Mutex, RwLock};

use crate::test_network::TestNetwork;

/// Given a blockchain and a network creates an instance of Consensus.
pub async fn consensus<N: NetworkInterface + TestNetwork>(
pub async fn consensus<N: Network + TestNetwork>(
blockchain: Arc<RwLock<Blockchain>>,
net: Arc<N>,
) -> Consensus<N> {
Expand Down
6 changes: 1 addition & 5 deletions validator/src/proposal_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,11 +563,7 @@ mod test {

use futures::{FutureExt, StreamExt};
use nimiq_block::MacroHeader;
use nimiq_blockchain::Blockchain;
use nimiq_blockchain_proxy::BlockchainProxy;
use nimiq_consensus::{
sync::syncer_proxy::SyncerProxy, BlsCache, Consensus, ConsensusEvent, ConsensusProxy,
};
use nimiq_consensus::{ConsensusEvent, ConsensusProxy};
use nimiq_keys::{KeyPair as SchnorrKeyPair, PrivateKey as SchnorrPrivateKey};
use nimiq_network_interface::network::Network as NetworkInterface;
use nimiq_network_mock::{MockHub, MockNetwork};
Expand Down

0 comments on commit 0bc22d5

Please sign in to comment.