Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

ExecutionEngine.callingScriptHash() problem return value #12

Open
sjoerd-dijkstra opened this issue Feb 23, 2018 · 0 comments
Open

ExecutionEngine.callingScriptHash() problem return value #12

sjoerd-dijkstra opened this issue Feb 23, 2018 · 0 comments

Comments

@sjoerd-dijkstra
Copy link

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant