Fix panic on importing own invalid transaction (#3550)

This commit is contained in:
Arkadiy Paronyan 2016-11-23 08:46:55 +01:00 committed by Tomasz Drwięga
parent cbeb2dc3f9
commit a969c008d1

View File

@ -580,15 +580,13 @@ impl Miner {
let gas_required = |tx: &SignedTransaction| tx.gas_required(&schedule).into();
let best_block_header: Header = ::rlp::decode(&chain.best_block_header());
transactions.into_iter()
.filter(|tx| match self.engine.verify_transaction_basic(tx, &best_block_header) {
Ok(()) => true,
.map(|tx| {
match self.engine.verify_transaction_basic(&tx, &best_block_header) {
Err(e) => {
debug!(target: "miner", "Rejected tx {:?} with invalid signature: {:?}", tx.hash(), e);
false
}
}
)
.map(|tx| {
Err(e)
},
Ok(()) => {
let origin = accounts.as_ref().and_then(|accounts| {
tx.sender().ok().and_then(|sender| match accounts.contains(&sender) {
true => Some(TransactionOrigin::Local),
@ -604,6 +602,8 @@ impl Miner {
transaction_queue.add_with_banlist(tx, &fetch_account, &gas_required)
}
}
},
}
})
.collect()
}