exposing in lib
This commit is contained in:
parent
57e6e1e1b5
commit
e100ecbeac
@ -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)]
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user