core: hangle CallingScriptHash correctly

When using native contracts, script hash of second-to-top context
on invocation stack does not always correspond to a real calling
contract.
This commit is contained in:
Evgenii Stratonikov 2020-12-10 16:52:16 +03:00
parent e903e40085
commit e63191d31f
4 changed files with 33 additions and 5 deletions

View file

@ -440,7 +440,8 @@ func getTestContractState() (*state.Contract, *state.Contract) {
emit.Syscall(w.BinWriter, interopnames.SystemStorageGet)
emit.Opcodes(w.BinWriter, opcode.RET)
onPaymentOff := w.Len()
emit.Int(w.BinWriter, 3)
emit.Syscall(w.BinWriter, interopnames.SystemRuntimeGetCallingScriptHash)
emit.Int(w.BinWriter, 4)
emit.Opcodes(w.BinWriter, opcode.PACK)
emit.String(w.BinWriter, "LastPayment")
emit.Syscall(w.BinWriter, interopnames.SystemRuntimeNotify)