core: add conflicts attribute

Close #1491
This commit is contained in:
Anna Shaleva 2020-10-15 14:45:29 +03:00
parent f259a614de
commit ec63d5c456
15 changed files with 499 additions and 37 deletions

View file

@ -5,6 +5,7 @@ import (
"encoding/json"
"testing"
"github.com/nspcc-dev/neo-go/pkg/internal/random"
"github.com/nspcc-dev/neo-go/pkg/internal/testserdes"
"github.com/stretchr/testify/require"
)
@ -59,6 +60,15 @@ func TestAttribute_EncodeBinary(t *testing.T) {
require.Error(t, err)
})
})
t.Run("Conflicts", func(t *testing.T) {
attr := &Attribute{
Type: ConflictsT,
Value: &Conflicts{
Hash: random.Uint256(),
},
}
testserdes.EncodeDecodeBinary(t, attr, new(Attribute))
})
}
func TestAttribute_MarshalJSON(t *testing.T) {
@ -104,4 +114,13 @@ func TestAttribute_MarshalJSON(t *testing.T) {
}
testserdes.MarshalUnmarshalJSON(t, attr, new(Attribute))
})
t.Run("Conflicts", func(t *testing.T) {
attr := &Attribute{
Type: ConflictsT,
Value: &Conflicts{
Hash: random.Uint256(),
},
}
testserdes.MarshalUnmarshalJSON(t, attr, new(Attribute))
})
}