2

When I run method that throws or runs out of gas I get nothing in error variable in callback. Method acts like everything's ok, but no changes are made.

For example I call:

Test.methodThatThrows({gas: 4752390,from: web3.eth.coinbase}, function(err, res) {console.log(err, res)});

I get output like

null 0x6d5a561224940daa70d6d56c60909255b86af7b9e93a0d8a4f98cacddf0d722b

This is very confusing, especially when you silently run out of has and don't know what's wrong.

I don't know if it's some compiler or geth option or something, couldn't find out.

I'm using geth 1.4.12-stable-421df866 solc Version: 0.4.1+commit.4fc6fc2.Darwin.appleclang or 0.4.3-develop.2016.9.22+commit.c06ba011.Darwin.appleclang

EDIT: Note, using testrpc would give you back error in such case. With normal network you need to use practices described in the answer.

1

When you send a transaction, your local Ethereum node will return to you a unique transaction hash. Your transaction is sent to the network (or your private node miner). Your transaction will then be chosen to be included into a block and executed, and mined by a miner.

The status of your transaction will only be know after it is mined.

To find out whether your transaction has succeeded or failed (thrown), use the procedures in How can the transaction status from a thrown error be detected when gas can be exactly the same as the gasUsed for a successful transaction?.

1
  • 1
    Oh, I was confused, because first I was trying it with testrpc, which gives you error back, so I kinda expected the same from normal net
    – ma2s
    Sep 23 '16 at 7:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.