Added pending transaction info to eth_getTransactionByHash (#4570)
* Return condition info for pending transactions * Fixed warnings
This commit is contained in:
committed by
Gav Wood
parent
b9665c7cfe
commit
0aad8a87ae
@@ -984,7 +984,7 @@ impl MinerService for Miner {
|
||||
}
|
||||
}
|
||||
|
||||
fn transaction(&self, best_block: BlockNumber, hash: &H256) -> Option<SignedTransaction> {
|
||||
fn transaction(&self, best_block: BlockNumber, hash: &H256) -> Option<PendingTransaction> {
|
||||
let queue = self.transaction_queue.lock();
|
||||
match self.options.pending_set {
|
||||
PendingSet::AlwaysQueue => queue.find(hash),
|
||||
@@ -992,14 +992,14 @@ impl MinerService for Miner {
|
||||
self.from_pending_block(
|
||||
best_block,
|
||||
|| queue.find(hash),
|
||||
|sealing| sealing.transactions().iter().find(|t| &t.hash() == hash).cloned()
|
||||
|sealing| sealing.transactions().iter().find(|t| &t.hash() == hash).cloned().map(Into::into)
|
||||
)
|
||||
},
|
||||
PendingSet::AlwaysSealing => {
|
||||
self.from_pending_block(
|
||||
best_block,
|
||||
|| None,
|
||||
|sealing| sealing.transactions().iter().find(|t| &t.hash() == hash).cloned()
|
||||
|sealing| sealing.transactions().iter().find(|t| &t.hash() == hash).cloned().map(Into::into)
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ pub trait MinerService : Send + Sync {
|
||||
where F: FnOnce(&ClosedBlock) -> T, Self: Sized;
|
||||
|
||||
/// Query pending transactions for hash.
|
||||
fn transaction(&self, best_block: BlockNumber, hash: &H256) -> Option<SignedTransaction>;
|
||||
fn transaction(&self, best_block: BlockNumber, hash: &H256) -> Option<PendingTransaction>;
|
||||
|
||||
/// Get a list of all pending transactions in the queue.
|
||||
fn pending_transactions(&self) -> Vec<PendingTransaction>;
|
||||
|
||||
@@ -1137,8 +1137,8 @@ impl TransactionQueue {
|
||||
}
|
||||
|
||||
/// Finds transaction in the queue by hash (if any)
|
||||
pub fn find(&self, hash: &H256) -> Option<SignedTransaction> {
|
||||
self.by_hash.get(hash).map(|tx| tx.transaction.clone())
|
||||
pub fn find(&self, hash: &H256) -> Option<PendingTransaction> {
|
||||
self.by_hash.get(hash).map(|tx| PendingTransaction { transaction: tx.transaction.clone(), condition: tx.condition.clone() })
|
||||
}
|
||||
|
||||
/// Removes all elements (in any state) from the queue
|
||||
|
||||
Reference in New Issue
Block a user