简体   繁体   中英

'transaction: out of gas' when truffle test, set mapping key value error

the contract function is

function _removeFlag(address sender) internal {
    //remove if in record
    if (mapping1[sender] > 0) {
       mapping1[sender] = 0;
    }
}        

when my test case running into this function , show an erro like:

truffle>: truffle test

Error: Returned error: VM Exception while processing transaction: out of gas

if i set it with:
mapping1[sender] = 1;

the error disappear,

can somebody help me? thank you

version info

Truffle v5.4.0 (core: 5.4.0) Solidity v0.5.16 (solc-js) Node v16.4.2 Web3.js v1.4.0

First check your account balance : balance = web3.eth.getBalance(someAddress); then try to specify the gaslimit contractInstance.createProposal("ADHD", "Foo", 2, {from: web3.eth.accounts[1], gas:3000000})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM