struct testR{
bytes32 name;
int32 count;
}
testR[] public tests;
function createTest(bytes32[] names) external returns (bool success) {
uint256 len = names.length;
for (uint8 i=0;i<len;i++){
tests.push(testR({name: names[i], count: 0}));
}
return true;
}
Here's my code. When I deploy this contract to my private network, function createTest just doesn't work, I pass array of converted to HEX strings, then when I call public array "tests" it always returns me 0x and null. If I try to compile and run this contract in Remix using JVM, it gives such error:
undefined errored: VM error: invalid opcode.
invalid opcode The constructor should be payable if you send value.
The execution might have thrown.
Debug the transaction to get more information.
I guess there's something wrong with my loop but it seems so simple.