Commit d66a7a48 authored by Alex Beregszaszi's avatar Alex Beregszaszi Committed by GitHub

Merge pull request #124 from ethereum/fix-estimategas

UDapp: don't supply a hardcoded limit to estimageGas, but judge based on the response
parents 8dbcb742 f1b0430e
...@@ -635,7 +635,6 @@ UniversalDApp.prototype.runTx = function (data, args, cb) { ...@@ -635,7 +635,6 @@ UniversalDApp.prototype.runTx = function (data, args, cb) {
from: self.options.getAddress ? self.options.getAddress() : self.web3.eth.accounts[0], from: self.options.getAddress ? self.options.getAddress() : self.web3.eth.accounts[0],
to: to, to: to,
data: data, data: data,
gas: gas,
value: value value: value
}; };
if (constant && !isConstructor) { if (constant && !isConstructor) {
...@@ -646,6 +645,10 @@ UniversalDApp.prototype.runTx = function (data, args, cb) { ...@@ -646,6 +645,10 @@ UniversalDApp.prototype.runTx = function (data, args, cb) {
return cb(err, resp); return cb(err, resp);
} }
if (resp > gas) {
return cb('Gas required exceeds limit: ' + resp);
}
tx.gas = resp; tx.gas = resp;
self.web3.eth.sendTransaction(tx, function (err, resp) { self.web3.eth.sendTransaction(tx, function (err, resp) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment