From 68ab8d935a8f54c5d0b949998ae59a41d4a5c3d7 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 12 Jan 2022 21:51:09 +0100 Subject: [PATCH 1/2] fixed compile issue for the rpc crate extended the MinerService trait with all_transactions, so we can use it in the RPC interface and still return all_transactions instead of queued_transaction. --- crates/ethcore/src/miner/miner.rs | 10 ++++++---- crates/ethcore/src/miner/mod.rs | 5 ++++- crates/rpc/src/v1/impls/parity.rs | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/crates/ethcore/src/miner/miner.rs b/crates/ethcore/src/miner/miner.rs index 42d4d3b35f..0cc70e034d 100644 --- a/crates/ethcore/src/miner/miner.rs +++ b/crates/ethcore/src/miner/miner.rs @@ -1073,10 +1073,7 @@ impl Miner { } } - /// Return all transactions currently in the transaction queue. - pub fn all_transactions(&self) -> Vec> { - self.transaction_queue.all_transactions() - } + } const SEALING_TIMEOUT_IN_BLOCKS: u64 = 5; @@ -1292,6 +1289,11 @@ impl miner::MinerService for Miner { ) } + /// Return all transactions currently in the transaction queue. + fn all_transactions(&self) -> Vec> { + self.transaction_queue.all_transactions() + } + fn queued_transaction_hashes(&self) -> Vec { self.transaction_queue.all_transaction_hashes() } diff --git a/crates/ethcore/src/miner/mod.rs b/crates/ethcore/src/miner/mod.rs index 52d8ddee27..5d2df936fe 100644 --- a/crates/ethcore/src/miner/mod.rs +++ b/crates/ethcore/src/miner/mod.rs @@ -242,11 +242,14 @@ pub trait MinerService: Send + Sync { self.ready_transactions_filtered(chain, max_len, None, ordering) } - /// Get a list of all transactions in the pool (some of them might not be ready for inclusion yet). + /// Get a list of queued transactions in the pool (some of them might not be ready for inclusion yet). fn queued_transactions(&self, chain: &C) -> Vec> where C: BlockChain + CallContract + Nonce + Sync; + /// Get a list of all transactions in the pool (some of them might not be ready for inclusion yet). + fn all_transactions(&self) -> Vec>; + /// Get a list of all transaction hashes in the pool (some of them might not be ready for inclusion yet). fn queued_transaction_hashes(&self) -> Vec; diff --git a/crates/rpc/src/v1/impls/parity.rs b/crates/rpc/src/v1/impls/parity.rs index a41ae0a370..01dda931ab 100644 --- a/crates/rpc/src/v1/impls/parity.rs +++ b/crates/rpc/src/v1/impls/parity.rs @@ -283,7 +283,7 @@ where } fn all_transactions(&self) -> Result> { - let all_transactions = self.miner.queued_transactions(); + let all_transactions = self.miner.all_transactions(); Ok(all_transactions .into_iter() From afc7caa853d00f3ee975e503bea2cae94c8f141e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 12 Jan 2022 21:57:12 +0100 Subject: [PATCH 2/2] cargo fmt --all -- --config imports_granularity=Crate --- crates/ethcore/src/miner/miner.rs | 10 ++++------ crates/ethcore/src/miner/mod.rs | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/crates/ethcore/src/miner/miner.rs b/crates/ethcore/src/miner/miner.rs index 0cc70e034d..742d3bd6d1 100644 --- a/crates/ethcore/src/miner/miner.rs +++ b/crates/ethcore/src/miner/miner.rs @@ -1072,8 +1072,6 @@ impl Miner { } } } - - } const SEALING_TIMEOUT_IN_BLOCKS: u64 = 5; @@ -1289,10 +1287,10 @@ impl miner::MinerService for Miner { ) } - /// Return all transactions currently in the transaction queue. - fn all_transactions(&self) -> Vec> { - self.transaction_queue.all_transactions() - } + /// Return all transactions currently in the transaction queue. + fn all_transactions(&self) -> Vec> { + self.transaction_queue.all_transactions() + } fn queued_transaction_hashes(&self) -> Vec { self.transaction_queue.all_transaction_hashes() diff --git a/crates/ethcore/src/miner/mod.rs b/crates/ethcore/src/miner/mod.rs index 5d2df936fe..24967d89a7 100644 --- a/crates/ethcore/src/miner/mod.rs +++ b/crates/ethcore/src/miner/mod.rs @@ -247,8 +247,8 @@ pub trait MinerService: Send + Sync { where C: BlockChain + CallContract + Nonce + Sync; - /// Get a list of all transactions in the pool (some of them might not be ready for inclusion yet). - fn all_transactions(&self) -> Vec>; + /// Get a list of all transactions in the pool (some of them might not be ready for inclusion yet). + fn all_transactions(&self) -> Vec>; /// Get a list of all transaction hashes in the pool (some of them might not be ready for inclusion yet). fn queued_transaction_hashes(&self) -> Vec;