Propagate transaction queue

This commit is contained in:
arkpar
2016-04-06 23:03:07 +02:00
parent 3f139116b2
commit cc0c54a45c
7 changed files with 28 additions and 35 deletions

View File

@@ -109,6 +109,9 @@ pub trait MinerService : Send + Sync {
/// Query pending transactions for hash
fn transaction(&self, hash: &H256) -> Option<SignedTransaction>;
/// Get a list of all pending transactions.
fn pending_transactions(&self) -> Vec<SignedTransaction>;
/// Returns highest transaction nonce for given address.
fn last_nonce(&self, address: &Address) -> Option<U256>;

View File

@@ -175,6 +175,11 @@ impl MinerService for Miner {
queue.find(hash)
}
fn pending_transactions(&self) -> Vec<SignedTransaction> {
let queue = self.transaction_queue.lock().unwrap();
queue.top_transactions()
}
fn last_nonce(&self, address: &Address) -> Option<U256> {
self.transaction_queue.lock().unwrap().last_nonce(address)
}