parent
4254407a9b
commit
b431e47d2a
3 changed files with 68 additions and 2 deletions
|
@ -5,11 +5,11 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||
"github.com/nspcc-dev/neo-go/pkg/neotest/chain"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
|
||||
"github.com/nspcc-dev/neo-go/pkg/neotest"
|
||||
"github.com/nspcc-dev/neo-go/pkg/neotest/chain"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -44,6 +44,33 @@ func TestLedger_GetTransactionHeight(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestLedger_GetTransactionState(t *testing.T) {
|
||||
c := newLedgerClient(t)
|
||||
e := c.Executor
|
||||
ledgerInvoker := c.WithSigners(c.Committee)
|
||||
|
||||
hash := e.InvokeScript(t, []byte{byte(opcode.RET)}, []neotest.Signer{c.Committee})
|
||||
|
||||
t.Run("unknown transaction", func(t *testing.T) {
|
||||
ledgerInvoker.Invoke(t, vm.NoneState, "getTransactionVMState", util.Uint256{1, 2, 3})
|
||||
})
|
||||
t.Run("not a hash", func(t *testing.T) {
|
||||
ledgerInvoker.InvokeFail(t, "expected []byte of size 32", "getTransactionVMState", []byte{1, 2, 3})
|
||||
})
|
||||
t.Run("good: HALT", func(t *testing.T) {
|
||||
ledgerInvoker.Invoke(t, vm.HaltState, "getTransactionVMState", hash)
|
||||
})
|
||||
t.Run("isn't traceable", func(t *testing.T) {
|
||||
// Add more blocks so that tx becomes untraceable.
|
||||
e.GenerateNewBlocks(t, int(e.Chain.GetConfig().MaxTraceableBlocks))
|
||||
ledgerInvoker.Invoke(t, vm.NoneState, "getTransactionVMState", hash)
|
||||
})
|
||||
t.Run("good: FAULT", func(t *testing.T) {
|
||||
faultedH := e.InvokeScript(t, []byte{byte(opcode.ABORT)}, []neotest.Signer{c.Committee})
|
||||
ledgerInvoker.Invoke(t, vm.FaultState, "getTransactionVMState", faultedH)
|
||||
})
|
||||
}
|
||||
|
||||
func TestLedger_GetTransaction(t *testing.T) {
|
||||
c := newLedgerClient(t)
|
||||
e := c.Executor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue