mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-27 03:58:06 +00:00
core/tests: extend native contract test
Check if native contract's method price is taken into account.
This commit is contained in:
parent
5354352d63
commit
e7d8bb92f6
1 changed files with 12 additions and 1 deletions
|
@ -107,7 +107,14 @@ func TestNativeContract_Invoke(t *testing.T) {
|
||||||
tx.ValidUntilBlock = validUntil
|
tx.ValidUntilBlock = validUntil
|
||||||
require.NoError(t, addSender(tx))
|
require.NoError(t, addSender(tx))
|
||||||
require.NoError(t, signTx(chain, tx))
|
require.NoError(t, signTx(chain, tx))
|
||||||
b := chain.newBlock(tx)
|
|
||||||
|
// Enough for Call and other opcodes, but not enough for "sum" call.
|
||||||
|
tx2 := transaction.New(chain.GetConfig().Magic, script, testSumPrice*2)
|
||||||
|
tx2.ValidUntilBlock = chain.blockHeight + 1
|
||||||
|
require.NoError(t, addSender(tx2))
|
||||||
|
require.NoError(t, signTx(chain, tx2))
|
||||||
|
|
||||||
|
b := chain.newBlock(tx, tx2)
|
||||||
require.NoError(t, chain.AddBlock(b))
|
require.NoError(t, chain.AddBlock(b))
|
||||||
|
|
||||||
res, err := chain.GetAppExecResult(tx.Hash())
|
res, err := chain.GetAppExecResult(tx.Hash())
|
||||||
|
@ -117,6 +124,10 @@ func TestNativeContract_Invoke(t *testing.T) {
|
||||||
require.Equal(t, smartcontract.IntegerType, res.Stack[0].Type)
|
require.Equal(t, smartcontract.IntegerType, res.Stack[0].Type)
|
||||||
require.EqualValues(t, 42, res.Stack[0].Value)
|
require.EqualValues(t, 42, res.Stack[0].Value)
|
||||||
|
|
||||||
|
res, err = chain.GetAppExecResult(tx2.Hash())
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Equal(t, "FAULT", res.VMState)
|
||||||
|
|
||||||
require.NoError(t, chain.persist())
|
require.NoError(t, chain.persist())
|
||||||
select {
|
select {
|
||||||
case index := <-tn.blocks:
|
case index := <-tn.blocks:
|
||||||
|
|
Loading…
Reference in a new issue