Error when using msg.value twice

nexus20001nexus20001 Member Posts: 1
Hi guys,

I try to deploy the following code:
 
contract Sample {

struct Participant {
address etherAddress;
uint amount;
}

Participant[] public participants;
uint public amountRaised;

function() {
enter();
}

function enter() {
uint amount = msg.value;
uint n = participants.length;

participants.length += 1;
participants[n].etherAddress = msg.sender;
participants[n].amount = amount;

amountRaised += amount;
}

}
In Mix IDE it works correctly but does not work on Ethereum testnet(balance not changed).
You can try here: http://testnet.etherscan.io/address/0xea1410a6d5ef3d6d5a392b24087c24845e7170a3
I noticed that contract works if delete participants[n].amount = amount OR amountRaised += amount line.
So, I can use only one msg.value variable.
How can I use msg.value twice?
Sign In or Register to comment.