Consider the following contract:
contract Test {
struct person {
uint id;
string name;
}
person[] p;
function addPerson (string _name) returns (bool added) {
person memory per;
per.id = msg.sender;
per.name = _name;
p.push[per];
}
function getPerson (address a) constant returns (address d, string n) {
for (uint k = 0; k <= k++) {
if (p[k].id == a) {
d = p[k].id;
n = p[k].name;
}
}
}
}
Upon making a web3 based sendTransaction to the 'addPerson' function, a transaction hash is produced. While retrieving the output of the constant function using eth.call as below:
TestObject.getPerson("0x1234", function(error, result){
if(!error)
console.log(result)
else
console.error(error);
});
the result is: ['0x','0x']
When the tested the same in the online solidity compiler, it results in the actual values passed in during the sendTransaction interaction. Any suggestions,as to how to get around this situation, to retrieve the actual results?