exposing in lib

This commit is contained in:
Nikolay Volf 2016-03-05 23:47:28 +03:00
parent 57e6e1e1b5
commit e100ecbeac
2 changed files with 14 additions and 0 deletions

View File

@ -1294,6 +1294,10 @@ impl ChainSync {
transaction_queue.add_all(txs, |a| chain.nonce(a));
});
}
pub fn transaction_queue(&self) -> &Mutex<TransactionQueue> {
return &self.transaction_queue;
}
}
#[cfg(test)]

View File

@ -128,6 +128,16 @@ impl EthSync {
pub fn restart(&mut self, io: &mut NetworkContext<SyncMessage>) {
self.sync.write().unwrap().restart(&mut NetSyncIo::new(io, self.chain.deref()));
}
/// Insert transaction in transaction queue
pub fn insert_transaction(&self, transaction: SignedTransaction) {
use util::numbers::*;
let nonce_fn = |a: &Address| self.chain.state().nonce(a) + U256::one();
let sync = self.sync.write().unwrap();
let mut queue = sync.transaction_queue().lock().unwrap();
queue.add(transaction, &nonce_fn);
}
}
impl NetworkProtocolHandler<SyncMessage> for EthSync {