I am using geth on a private chain. I have a Solidity function on a contract as follows:
function check() public constant returns (string) {
// if caller is not who it should be don't do anything
if ( msg.sender != expectedSender )
return;
// if caller is expected return some information
return someInformation;
}
I have the contract deployed and instantiated and call the method at the geth console like:
myContract.check();
I get an empty string , "", back when I make this call from the geth console. I unlocked an account with personal.unlockAccount() using the account expected for "expectedSender" but the msg.sender test still does not work.
Should this have worked? How do I make sure I call this function in the context of the correct account?