mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 09:42:22 +00:00
smartcontract: fix underlying PublicKey parameter value
Value of PublicKey parameter always stores public key bytes, not the deserialized representation. All other code (CLI parameters parsing with its NewParameterFromString, Parameter unmarshaller, etc.) is based on the idea that value of PublicKey is []byte.
This commit is contained in:
parent
478b4b0c1c
commit
641abd4d1c
2 changed files with 1 additions and 3 deletions
|
@ -387,8 +387,6 @@ func NewParametersFromValues(values ...interface{}) ([]Parameter, error) {
|
|||
func ExpandParameterToEmitable(param Parameter) (interface{}, error) {
|
||||
var err error
|
||||
switch t := param.Type; t {
|
||||
case PublicKeyType:
|
||||
return param.Value.(*keys.PublicKey).Bytes(), nil
|
||||
case ArrayType:
|
||||
arr := param.Value.([]Parameter)
|
||||
res := make([]interface{}, len(arr))
|
||||
|
|
|
@ -477,7 +477,7 @@ func TestExpandParameterToEmitable(t *testing.T) {
|
|||
Expected: util.Uint256{1, 2, 3},
|
||||
},
|
||||
{
|
||||
In: Parameter{Type: PublicKeyType, Value: pk.PublicKey()},
|
||||
In: Parameter{Type: PublicKeyType, Value: pk.PublicKey().Bytes()},
|
||||
Expected: pk.PublicKey().Bytes(),
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue