Full transaction cost

This commit is contained in:
Tomasz Drwięga 2016-03-17 10:23:09 +01:00
parent 81c36499ea
commit 95dda4aa68

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
}));
}