Merge branch 'master' of github.com:ethcore/parity
This commit is contained in:
commit
33f187eeee
@ -420,7 +420,7 @@ impl MinerService for Miner {
|
||||
|
||||
fn transaction(&self, hash: &H256) -> Option<SignedTransaction> {
|
||||
match (self.sealing_enabled.load(atomic::Ordering::Relaxed), self.sealing_work.lock().unwrap().peek_last_ref()) {
|
||||
(true, Some(pending)) => pending.transactions().iter().find(|t| &t.hash() == hash).map(|t| t.clone()),
|
||||
(true, Some(pending)) => pending.transactions().iter().find(|t| &t.hash() == hash).cloned(),
|
||||
_ => {
|
||||
let queue = self.transaction_queue.lock().unwrap();
|
||||
queue.find(hash)
|
||||
|
@ -75,6 +75,7 @@ impl Informant {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(feature="dev", allow(match_bool))]
|
||||
pub fn tick(&self, client: &Client, maybe_sync: Option<&EthSync>) {
|
||||
let elapsed = self.last_tick.read().unwrap().elapsed();
|
||||
if elapsed < Duration::from_secs(5) {
|
||||
|
@ -672,18 +672,26 @@ impl<C, M> EthFilter for EthFilterClient<C, M> where
|
||||
to_value(&hashes)
|
||||
},
|
||||
PollFilter::PendingTransaction(ref mut previous_hashes) => {
|
||||
// get hashes of pending transactions
|
||||
let current_hashes = take_weak!(self.miner).pending_transactions_hashes();
|
||||
// calculate diff
|
||||
let previous_hashes_set = previous_hashes.into_iter().map(|h| h.clone()).collect::<HashSet<H256>>();
|
||||
let diff = current_hashes
|
||||
.iter()
|
||||
.filter(|hash| previous_hashes_set.contains(&hash))
|
||||
.cloned()
|
||||
.collect::<Vec<H256>>();
|
||||
|
||||
let new_hashes =
|
||||
{
|
||||
let previous_hashes_set = previous_hashes.iter().collect::<HashSet<_>>();
|
||||
|
||||
// find all new hashes
|
||||
current_hashes
|
||||
.iter()
|
||||
.filter(|hash| !previous_hashes_set.contains(hash))
|
||||
.cloned()
|
||||
.collect::<Vec<H256>>()
|
||||
};
|
||||
|
||||
// save all hashes of pending transactions
|
||||
*previous_hashes = current_hashes;
|
||||
|
||||
to_value(&diff)
|
||||
// return new hashes
|
||||
to_value(&new_hashes)
|
||||
},
|
||||
PollFilter::Logs(ref mut block_number, ref mut previous_logs, ref filter) => {
|
||||
// retrive the current block number
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! kvdb::Database as migration::Destination
|
||||
//! `kvdb::Database` as `migration::Destination`
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use kvdb::{Database, DBTransaction};
|
||||
|
Loading…
Reference in New Issue
Block a user