This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fixpending #1074
Merged
Merged
Fixpending #1074
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
897dc52
Fix --geth IPC for MacOS.
gavofyork 3fab8d5
fix pending_* methods in MinerService, add pending_receipts
gavofyork 7b00ebc
Merge branch 'master' into fixpending
gavofyork b80c1c3
Merge branch 'master' of github.com:ethcore/parity into fixpending
debris 1442a28
pending logs
debris 897c5f3
include pending logs when polling
debris fc7739d
Merge branch 'master' into fixpending
debris c51820e
fixed returning pending logs multiple timees
debris ae1e4fb
log type
debris 387249f
Merge branch 'master' of github.com:ethcore/parity into fixpending
debris c69ef8b
Merge branch 'master' of github.com:ethcore/parity into fixpending
debris 242a66e
Merge branch 'master' of github.com:ethcore/parity into fixpending
debris fa0fe66
transactionHash is supplied to pending logs
debris 576bcff
Merge branch 'master' into fixpending
debris 7f568ef
miner returns receipts together with hashes
debris 42143f9
bring back miners all_transactions used by sync module
debris 164994f
Merge branch 'master' of github.com:ethcore/parity into fixpending
debris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ use ethcore::block::{ClosedBlock, IsBlock}; | |
use ethcore::error::*; | ||
use ethcore::client::{Executive, Executed, EnvInfo, TransactOptions}; | ||
use ethcore::transaction::SignedTransaction; | ||
use ethcore::receipt::{Receipt}; | ||
use ethcore::spec::Spec; | ||
use ethcore::engine::Engine; | ||
use super::{MinerService, MinerStatus, TransactionQueue, AccountDetails, TransactionImportResult, TransactionOrigin}; | ||
|
@@ -407,20 +408,56 @@ impl MinerService for Miner { | |
} | ||
|
||
fn pending_transactions_hashes(&self) -> Vec<H256> { | ||
let transaction_queue = self.transaction_queue.lock().unwrap(); | ||
transaction_queue.pending_hashes() | ||
match (self.sealing_enabled.load(atomic::Ordering::Relaxed), self.sealing_work.lock().unwrap().peek_last_ref()) { | ||
(true, Some(pending)) => pending.transactions().iter().map(|t| t.hash()).collect(), | ||
_ => { | ||
let queue = self.transaction_queue.lock().unwrap(); | ||
queue.pending_hashes() | ||
} | ||
} | ||
} | ||
|
||
fn transaction(&self, hash: &H256) -> Option<SignedTransaction> { | ||
let queue = self.transaction_queue.lock().unwrap(); | ||
queue.find(hash) | ||
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()), | ||
_ => { | ||
let queue = self.transaction_queue.lock().unwrap(); | ||
queue.find(hash) | ||
} | ||
} | ||
} | ||
|
||
fn pending_transactions(&self) -> Vec<SignedTransaction> { | ||
fn all_transactions(&self) -> Vec<SignedTransaction> { | ||
let queue = self.transaction_queue.lock().unwrap(); | ||
queue.top_transactions() | ||
} | ||
|
||
fn pending_transactions(&self) -> Vec<SignedTransaction> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pending transactions is used also when propagating transactions - does it mean that we don't want to propagate everything from queue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All valid transactions should be propogated |
||
// TODO: should only use the sealing_work when it's current (it could be an old block) | ||
match (self.sealing_enabled.load(atomic::Ordering::Relaxed), self.sealing_work.lock().unwrap().peek_last_ref()) { | ||
(true, Some(pending)) => pending.transactions().clone(), | ||
_ => { | ||
let queue = self.transaction_queue.lock().unwrap(); | ||
queue.top_transactions() | ||
} | ||
} | ||
} | ||
|
||
fn pending_receipts(&self) -> BTreeMap<H256, Receipt> { | ||
match (self.sealing_enabled.load(atomic::Ordering::Relaxed), self.sealing_work.lock().unwrap().peek_last_ref()) { | ||
(true, Some(pending)) => { | ||
let hashes = pending.transactions() | ||
.iter() | ||
.map(|t| t.hash()); | ||
|
||
let receipts = pending.receipts().clone().into_iter(); | ||
|
||
hashes.zip(receipts).collect() | ||
}, | ||
_ => BTreeMap::new() | ||
} | ||
} | ||
|
||
fn last_nonce(&self, address: &Address) -> Option<U256> { | ||
self.transaction_queue.lock().unwrap().last_nonce(address) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
//! Helper type with all filter possibilities. | ||
//! Helper type with all filter state data. | ||
|
||
use std::collections::HashSet; | ||
use util::hash::H256; | ||
use ethcore::filter::Filter; | ||
use v1::types::{Filter, Log}; | ||
|
||
pub type BlockNumber = u64; | ||
|
||
/// Filter state. | ||
#[derive(Clone)] | ||
pub enum PollFilter { | ||
/// Number of last block which client was notified about. | ||
Block(BlockNumber), | ||
/// Hashes of all transactions which client was notified about. | ||
PendingTransaction(Vec<H256>), | ||
Logs(BlockNumber, Filter) | ||
/// Number of From block number, pending logs and log filter iself. | ||
Logs(BlockNumber, HashSet<Log>, Filter) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used 4 times here. Perhaps could be extracted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the idea here? Return only transactions from the pending block if sealing is enabled, return all transactions from the queue otherwise? Where is this required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are maintaining a pending block, then we return the transactions within that block. if we are not maintaining a pending block, then we replicate the old behaviour of just using all submitted (in queue) transactions.
really, there should be another tag aside from
pending
, something likesubmitted
, which does the original behaviour, andpending
should mean only those transactions which have been executed locally (and have according receipts).