[#505] event/container: Change number of items in Put event

Change expected event items to 4 in order to support new binary session
token item. Parsing of the session token will be implemented later.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-05-25 12:15:24 +03:00 committed by Alex Vanin
parent ac2d347884
commit f2778361c8
2 changed files with 6 additions and 3 deletions

View file

@ -15,6 +15,8 @@ type Put struct {
publicKey []byte publicKey []byte
} }
const expectedItemNumPut = 4
// MorphEvent implements Neo:Morph Event interface. // MorphEvent implements Neo:Morph Event interface.
func (Put) MorphEvent() {} func (Put) MorphEvent() {}
@ -34,8 +36,8 @@ func ParsePut(params []stackitem.Item) (event.Event, error) {
err error err error
) )
if ln := len(params); ln != 3 { if ln := len(params); ln != expectedItemNumPut {
return nil, event.WrongNumberOfParameters(3, ln) return nil, event.WrongNumberOfParameters(expectedItemNumPut, ln)
} }
// parse container // parse container

View file

@ -22,7 +22,7 @@ func TestParsePut(t *testing.T) {
} }
_, err := ParsePut(prms) _, err := ParsePut(prms)
require.EqualError(t, err, event.WrongNumberOfParameters(3, len(prms)).Error()) require.EqualError(t, err, event.WrongNumberOfParameters(expectedItemNumPut, len(prms)).Error())
}) })
t.Run("wrong container parameter", func(t *testing.T) { t.Run("wrong container parameter", func(t *testing.T) {
@ -57,6 +57,7 @@ func TestParsePut(t *testing.T) {
stackitem.NewByteArray(containerData), stackitem.NewByteArray(containerData),
stackitem.NewByteArray(signature), stackitem.NewByteArray(signature),
stackitem.NewByteArray(publicKey), stackitem.NewByteArray(publicKey),
stackitem.NewMap(),
}) })
require.NoError(t, err) require.NoError(t, err)