neo-devpack-java
neo-devpack-java copied to clipboard
ExecutionEngine.callingScriptHash() problem return value
Dear devs,
When calling ExecutionEngine.callingScriptHash()
from org.neo.smartcontract.framework.services.system
we are experiencing a problem when verifying another smart contract.
When the function is called in Main()
, it gives the correct smart contract caller hash. Like so:
public class Token extends SmartContract{
// main
public static Object Main(String operation, Object[] args) {
// correct hash
byte[] caller = (byte[]) ExecutionEngine.callingScriptHash();
}
}
However, when calling the script from a nested function in Main()
, for example someFunction()
that returns a boolean
is gives a different and incorrect hash when the script is called. Like so:
public class Token extends SmartContract{
// some function
public static boolean someFuntion() {
// wrong and different hash!
byte[] caller = (byte[]) ExecutionEngine.callingScriptHash(); // < ----
return true;
}
// main
public static Object Main(String operation, Object[] args) {
// function call
someFuntion();
}
}
Could you help me? How can we avoid this situation? I can provide more info. We can not verify a script now. Are we doing something wrong maybe?