This is a function in my contract. There is noting complex about this it shows a warning that the gas requirement is large on remix
. I speculate this might be a reason why I had gas issues while trying to deploy using truffle
.
First of all I need to understand the issue.
function sendEther(string data) payable {
address sender = msg.sender;
uint value = msg.value;
voter[sender].data = data;
voter[sender].amount = value;
voterIndex[voter_count] = sender;
voter_count = voter_count + 1;
Deposit(sender, value);
}
Note: I found a similar issue where the user was trying to send a transaction which could be a normal address or a contract and thus had the issue. No idea why it happens to me.
EDIT: The constant
keyword was a typos. But the actual question was answered precisely below.