Full transaction cost

This commit is contained in:
Tomasz Drwięga 2016-03-17 10:23:09 +01:00 committed by arkpar
parent 4be4a1c151
commit d17c629b71

View File

@ -343,14 +343,16 @@ impl TransactionQueue {
}));
}
let vtx = try!(VerifiedTransaction::new(tx));
let account = fetch_account(&vtx.sender());
if account.balance < vtx.transaction.value {
let cost = vtx.transaction.value + vtx.transaction.gas_price * vtx.transaction.gas;
if account.balance < cost {
trace!(target: "miner", "Dropping transaction without sufficient balance: {:?} ({} < {})",
vtx.hash(), account.balance, vtx.transaction.value);
vtx.hash(), account.balance, cost);
return Err(Error::Transaction(TransactionError::InsufficientBalance {
cost: vtx.transaction.value,
cost: cost,
balance: account.balance
}));
}