exposing only one func

This commit is contained in:
Nikolay Volf 2016-03-10 13:27:33 +04:00
parent ddc3440712
commit a2046b429f
2 changed files with 8 additions and 4 deletions

View File

@ -43,6 +43,7 @@ use io::SyncIo;
use transaction_queue::TransactionQueue; use transaction_queue::TransactionQueue;
use time; use time;
use super::SyncConfig; use super::SyncConfig;
use ethcore;
known_heap_size!(0, PeerInfo, Header, HeaderId); known_heap_size!(0, PeerInfo, Header, HeaderId);
@ -1300,8 +1301,12 @@ impl ChainSync {
// TODO [todr] propagate transactions? // TODO [todr] propagate transactions?
} }
pub fn transaction_queue(&self) -> &Mutex<TransactionQueue> { /// Add transaction to the transaction queue
return &self.transaction_queue; pub fn insert_transaction<T>(&self, transaction: ethcore::transaction::SignedTransaction, fetch_nonce: &T)
where T: Fn(&Address) -> U256
{
let mut queue = self.transaction_queue.lock().unwrap();
queue.add(transaction, fetch_nonce);
} }
} }

View File

@ -135,8 +135,7 @@ impl EthSync {
let nonce_fn = |a: &Address| self.chain.state().nonce(a) + U256::one(); let nonce_fn = |a: &Address| self.chain.state().nonce(a) + U256::one();
let sync = self.sync.write().unwrap(); let sync = self.sync.write().unwrap();
let mut queue = sync.transaction_queue().lock().unwrap(); sync.insert_transaction(transaction, &nonce_fn);
queue.add(transaction, &nonce_fn);
} }
} }