Implement signed data calculating function from SignedDataReader

This commit is contained in:
Leonard Lyubich 2020-05-11 17:28:44 +03:00
parent ab198b4049
commit e01fb0cc62
10 changed files with 126 additions and 149 deletions

View file

@ -5,6 +5,7 @@ import (
"io"
"github.com/nspcc-dev/neofs-api-go/refs"
"github.com/nspcc-dev/neofs-api-go/service"
)
const signedRequestDataSize = 0 +
@ -31,14 +32,7 @@ func (m *CreateRequest) SetOwnerID(id OwnerID) {
// SignedData returns payload bytes of the request.
func (m CreateRequest) SignedData() ([]byte, error) {
data := make([]byte, m.SignedDataSize())
_, err := m.ReadSignedData(data)
if err != nil {
return nil, err
}
return data, nil
return service.SignedDataFromReader(m)
}
// SignedDataSize returns payload size of the request.