Merge pull request #676 from ethcore/fix-tx-warnings

fix warning for transaction_queue.add usage
This commit is contained in:
Nikolay Volf 2016-03-11 19:48:05 +03:00
commit eaf22198e2
3 changed files with 6 additions and 5 deletions

View File

@ -1307,11 +1307,11 @@ impl ChainSync {
}
/// Add transaction to the transaction queue
pub fn insert_transaction<T>(&self, transaction: ethcore::transaction::SignedTransaction, fetch_nonce: &T)
pub fn insert_transaction<T>(&self, transaction: ethcore::transaction::SignedTransaction, fetch_nonce: &T) -> Result<(), Error>
where T: Fn(&Address) -> U256
{
let mut queue = self.transaction_queue.lock().unwrap();
queue.add(transaction, fetch_nonce);
queue.add(transaction, fetch_nonce)
}
}

View File

@ -146,7 +146,8 @@ impl SyncProvider for EthSync {
let nonce_fn = |a: &Address| self.chain.state().nonce(a) + U256::one();
let sync = self.sync.write().unwrap();
sync.insert_transaction(transaction, &nonce_fn);
sync.insert_transaction(transaction, &nonce_fn).unwrap_or_else(
|e| warn!(target: "sync", "Error inserting transaction to queue: {:?}", e));
}
}

View File

@ -684,8 +684,8 @@ mod test {
let mut txq = TransactionQueue::new();
let (tx, tx2) = new_txs(U256::from(1));
txq.add(tx.clone(), &prev_nonce);
txq.add(tx2.clone(), &prev_nonce);
txq.add(tx.clone(), &prev_nonce).unwrap();
txq.add(tx2.clone(), &prev_nonce).unwrap();
assert_eq!(txq.status().future, 2);
// when