Merge pull request #1531 from nspcc-dev/core/applicationlog_with_multiple_triggers
core, rpc: store multiple execution results for single hash
This commit is contained in:
commit
0f827ee6ba
21 changed files with 441 additions and 199 deletions
|
@ -108,21 +108,25 @@ var rpcClientTestCases = map[string][]rpcClientTestCase{
|
|||
{
|
||||
name: "positive",
|
||||
invoke: func(c *Client) (interface{}, error) {
|
||||
return c.GetApplicationLog(util.Uint256{})
|
||||
return c.GetApplicationLog(util.Uint256{}, nil)
|
||||
},
|
||||
serverResponse: `{"id":1,"jsonrpc":"2.0","result":{"txid":"0x17145a039fca704fcdbeb46e6b210af98a1a9e5b9768e46ffc38f71c79ac2521","trigger":"Application","vmstate":"HALT","gasconsumed":"1","stack":[{"type":"Integer","value":"1"}],"notifications":[]}}`,
|
||||
serverResponse: `{"id":1,"jsonrpc":"2.0","result":{"txid":"0x17145a039fca704fcdbeb46e6b210af98a1a9e5b9768e46ffc38f71c79ac2521","executions":[{"trigger":"Application","vmstate":"HALT","gasconsumed":"1","stack":[{"type":"Integer","value":"1"}],"notifications":[]}]}}`,
|
||||
result: func(c *Client) interface{} {
|
||||
txHash, err := util.Uint256DecodeStringLE("17145a039fca704fcdbeb46e6b210af98a1a9e5b9768e46ffc38f71c79ac2521")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return &state.AppExecResult{
|
||||
TxHash: txHash,
|
||||
Trigger: trigger.Application,
|
||||
VMState: vm.HaltState,
|
||||
GasConsumed: 1,
|
||||
Stack: []stackitem.Item{stackitem.NewBigInteger(big.NewInt(1))},
|
||||
Events: []state.NotificationEvent{},
|
||||
return &result.ApplicationLog{
|
||||
Container: txHash,
|
||||
Executions: []state.Execution{
|
||||
{
|
||||
Trigger: trigger.Application,
|
||||
VMState: vm.HaltState,
|
||||
GasConsumed: 1,
|
||||
Stack: []stackitem.Item{stackitem.NewBigInteger(big.NewInt(1))},
|
||||
Events: []state.NotificationEvent{},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -969,7 +973,7 @@ var rpcClientErrorCases = map[string][]rpcClientErrorCase{
|
|||
{
|
||||
name: "getapplicationlog_invalid_params_error",
|
||||
invoke: func(c *Client) (interface{}, error) {
|
||||
return c.GetApplicationLog(util.Uint256{})
|
||||
return c.GetApplicationLog(util.Uint256{}, nil)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1144,7 +1148,7 @@ var rpcClientErrorCases = map[string][]rpcClientErrorCase{
|
|||
{
|
||||
name: "getapplicationlog_unmarshalling_error",
|
||||
invoke: func(c *Client) (interface{}, error) {
|
||||
return c.GetApplicationLog(util.Uint256{})
|
||||
return c.GetApplicationLog(util.Uint256{}, nil)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue