Merge pull request #676 from ethcore/fix-tx-warnings
fix warning for transaction_queue.add usage
This commit is contained in:
commit
eaf22198e2
@ -1307,11 +1307,11 @@ impl ChainSync {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Add transaction to the transaction queue
|
/// 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
|
where T: Fn(&Address) -> U256
|
||||||
{
|
{
|
||||||
let mut queue = self.transaction_queue.lock().unwrap();
|
let mut queue = self.transaction_queue.lock().unwrap();
|
||||||
queue.add(transaction, fetch_nonce);
|
queue.add(transaction, fetch_nonce)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,8 @@ impl SyncProvider for 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();
|
||||||
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,8 +684,8 @@ mod test {
|
|||||||
let mut txq = TransactionQueue::new();
|
let mut txq = TransactionQueue::new();
|
||||||
|
|
||||||
let (tx, tx2) = new_txs(U256::from(1));
|
let (tx, tx2) = new_txs(U256::from(1));
|
||||||
txq.add(tx.clone(), &prev_nonce);
|
txq.add(tx.clone(), &prev_nonce).unwrap();
|
||||||
txq.add(tx2.clone(), &prev_nonce);
|
txq.add(tx2.clone(), &prev_nonce).unwrap();
|
||||||
assert_eq!(txq.status().future, 2);
|
assert_eq!(txq.status().future, 2);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
|
Loading…
Reference in New Issue
Block a user