0

I added the following two lines of code to my function:

uint gas_remaining = msg.gas;
//irrelevant code....
refund = refund + ((gas_remaining - msg.gas) * tx.gasprice);

For some reason this is causing the following error:

transact to browser/ballot.sol:Lottery.buyT errored: VM error: revert.
revert  The transaction has been reverted to the initial state.

Am I doing something wrong?

  • 1
    where is refund defined? and what is the value of it before that line? – flygoing Nov 18 '17 at 15:37
  • @mankee It is unlikely that the refund line will cause a revert. – Ismael Nov 21 '17 at 2:08

Your Answer

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

Browse other questions tagged or ask your own question.