mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-05 23:55:11 +00:00
state: use checksums and names to calculate contract hashes
It allows to deploy the same NEF using one sender and get different contract hashes. See neo-project/neo#2240.
This commit is contained in:
parent
6b9b37f170
commit
054ca27e9c
14 changed files with 76 additions and 39 deletions
|
@ -556,11 +556,11 @@ func TestVerifyTx(t *testing.T) {
|
|||
})
|
||||
tx.Scripts = append(tx.Scripts, transaction.Witness{})
|
||||
t.Run("NonZeroVerification", func(t *testing.T) {
|
||||
script, _ := state.CreateNativeContractHash(-6) //oracleContractID
|
||||
w := io.NewBufBinWriter()
|
||||
emit.Opcodes(w.BinWriter, opcode.ABORT)
|
||||
emit.Bytes(w.BinWriter, util.Uint160{}.BytesBE())
|
||||
emit.Bytes(w.BinWriter, script)
|
||||
emit.Int(w.BinWriter, int64(orc.NEF.Checksum))
|
||||
emit.String(w.BinWriter, orc.Manifest.Name)
|
||||
tx.Scripts[len(tx.Scripts)-1].VerificationScript = w.Bytes()
|
||||
err := bc.VerifyTx(tx)
|
||||
require.True(t, errors.Is(err, ErrNativeContractWitness), "got: %v", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue