Validating minimal required gas for a transaction (#2937)

* Validating minimal required gas for a transaction

* Adding RPC case and note

* Fixing whitespace [ci skip]
This commit is contained in:
Tomasz Drwięga
2016-10-28 16:42:24 +02:00
committed by Gav Wood
parent 2806f1d4c9
commit 0f0334275e
8 changed files with 218 additions and 130 deletions

View File

@@ -47,6 +47,13 @@ pub enum TransactionError {
/// Transaction gas price
got: U256,
},
/// Transaction's gas is below currently set minimal gas requirement.
InsufficientGas {
/// Minimal expected gas
minimal: U256,
/// Transaction gas
got: U256,
},
/// Sender doesn't have enough funds to pay for this transaction
InsufficientBalance {
/// Senders balance
@@ -81,6 +88,8 @@ impl fmt::Display for TransactionError {
LimitReached => "Transaction limit reached".into(),
InsufficientGasPrice { minimal, got } =>
format!("Insufficient gas price. Min={}, Given={}", minimal, got),
InsufficientGas { minimal, got } =>
format!("Insufficient gas. Min={}, Given={}", minimal, got),
InsufficientBalance { balance, cost } =>
format!("Insufficient balance for transaction. Balance={}, Cost={}",
balance, cost),