diff --git a/pkg/core/transaction/witness_condition.go b/pkg/core/transaction/witness_condition.go index 316922605..71fcc1d33 100644 --- a/pkg/core/transaction/witness_condition.go +++ b/pkg/core/transaction/witness_condition.go @@ -549,7 +549,7 @@ func unmarshalArrayOfConditionJSONs(arr []json.RawMessage, maxDepth int) ([]Witn if l == 0 { return nil, errors.New("empty array of conditions") } - if l >= maxSubitems { + if l > maxSubitems { return nil, errors.New("too many elements") } res := make([]WitnessCondition, l) diff --git a/pkg/core/transaction/witness_scope.go b/pkg/core/transaction/witness_scope.go index 945fd3e92..5daf15eaa 100644 --- a/pkg/core/transaction/witness_scope.go +++ b/pkg/core/transaction/witness_scope.go @@ -1,6 +1,6 @@ package transaction -//go:generate stringer -type=WitnessScope -output=witness_scope_string.go +//go:generate stringer -type=WitnessScope -linecomment -output=witness_scope_string.go import ( "encoding/json" "fmt" @@ -23,7 +23,7 @@ const ( // CustomGroups define custom pubkey for group members. CustomGroups WitnessScope = 0x20 // Rules is a set of conditions with boolean operators. - Rules WitnessScope = 0x40 + Rules WitnessScope = 0x40 // WitnessRules // Global allows this witness in all contexts (default Neo2 behavior). // This cannot be combined with other flags. Global WitnessScope = 0x80 diff --git a/pkg/core/transaction/witness_scope_string.go b/pkg/core/transaction/witness_scope_string.go index 5f6666af1..805ac1473 100644 --- a/pkg/core/transaction/witness_scope_string.go +++ b/pkg/core/transaction/witness_scope_string.go @@ -1,4 +1,4 @@ -// Code generated by "stringer -type=WitnessScope -output=witness_scope_string.go"; DO NOT EDIT. +// Code generated by "stringer -type=WitnessScope -linecomment -output=witness_scope_string.go"; DO NOT EDIT. package transaction @@ -20,7 +20,7 @@ const ( _WitnessScope_name_0 = "NoneCalledByEntry" _WitnessScope_name_1 = "CustomContracts" _WitnessScope_name_2 = "CustomGroups" - _WitnessScope_name_3 = "Rules" + _WitnessScope_name_3 = "WitnessRules" _WitnessScope_name_4 = "Global" ) diff --git a/pkg/network/message_string.go b/pkg/network/message_string.go index 2ebdacd9b..8e516f377 100644 --- a/pkg/network/message_string.go +++ b/pkg/network/message_string.go @@ -62,7 +62,7 @@ var ( func (i CommandType) String() string { switch { - case i <= 1: + case 0 <= i && i <= 1: return _CommandType_name_0[_CommandType_index_0[i]:_CommandType_index_0[i+1]] case 16 <= i && i <= 17: i -= 16 diff --git a/pkg/rpc/server/server.go b/pkg/rpc/server/server.go index a60feace1..ea9a6c15e 100644 --- a/pkg/rpc/server/server.go +++ b/pkg/rpc/server/server.go @@ -1675,7 +1675,7 @@ func (s *Server) getInvokeScriptParams(reqParams request.Params) (*transaction.T if len(reqParams) > 1 { signers, witnesses, err := reqParams[1].GetSignersWithWitnesses() if err != nil { - return nil, false, response.ErrInvalidParams + return nil, false, response.WrapErrorWithData(response.ErrInvalidParams, err) } tx.Signers = signers tx.Scripts = witnesses @@ -1684,7 +1684,7 @@ func (s *Server) getInvokeScriptParams(reqParams request.Params) (*transaction.T if len(reqParams) > 2 { verbose, err = reqParams[2].GetBoolean() if err != nil { - return nil, false, response.ErrInvalidParams + return nil, false, response.WrapErrorWithData(response.ErrInvalidParams, err) } } if len(tx.Signers) == 0 {