mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 11:41:48 +00:00
core, rpc: allow to store several AppExecResult for a single hash
It is required for we have several executions per block.
This commit is contained in:
parent
e700fb2c96
commit
7ca93e76ac
18 changed files with 384 additions and 178 deletions
|
@ -68,15 +68,16 @@ var rpcTestCases = map[string][]rpcTestCase{
|
|||
{
|
||||
name: "positive",
|
||||
params: `["` + deploymentTxHash + `"]`,
|
||||
result: func(e *executor) interface{} { return &state.AppExecResult{} },
|
||||
result: func(e *executor) interface{} { return &result.ApplicationLog{} },
|
||||
check: func(t *testing.T, e *executor, acc interface{}) {
|
||||
res, ok := acc.(*state.AppExecResult)
|
||||
res, ok := acc.(*result.ApplicationLog)
|
||||
require.True(t, ok)
|
||||
expectedTxHash, err := util.Uint256DecodeStringLE(deploymentTxHash)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, expectedTxHash, res.TxHash)
|
||||
assert.Equal(t, trigger.Application, res.Trigger)
|
||||
assert.Equal(t, vm.HaltState, res.VMState)
|
||||
assert.Equal(t, 1, len(res.Executions))
|
||||
assert.Equal(t, expectedTxHash, res.Container)
|
||||
assert.Equal(t, trigger.Application, res.Executions[0].Trigger)
|
||||
assert.Equal(t, vm.HaltState, res.Executions[0].VMState)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -890,10 +891,13 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) []
|
|||
rpc := `{"jsonrpc": "2.0", "id": 1, "method": "getapplicationlog", "params": ["%s"]}`
|
||||
body := doRPCCall(fmt.Sprintf(rpc, e.chain.GetHeaderHash(1).StringLE()), httpSrv.URL, t)
|
||||
data := checkErrGetResult(t, body, false)
|
||||
var res state.AppExecResult
|
||||
var res result.ApplicationLog
|
||||
require.NoError(t, json.Unmarshal(data, &res))
|
||||
require.Equal(t, trigger.PostPersist, res.Trigger)
|
||||
require.Equal(t, vm.HaltState, res.VMState)
|
||||
require.Equal(t, 2, len(res.Executions))
|
||||
require.Equal(t, trigger.OnPersist, res.Executions[0].Trigger)
|
||||
require.Equal(t, vm.HaltState, res.Executions[0].VMState)
|
||||
require.Equal(t, trigger.PostPersist, res.Executions[1].Trigger)
|
||||
require.Equal(t, vm.HaltState, res.Executions[1].VMState)
|
||||
})
|
||||
|
||||
t.Run("submit", func(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue