[#1175] metabase: Fix encoding of updated locker list

Even single locker must be encoded using `encodeList`, or subsequent
`decodeList` call will fail.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-02-16 18:40:39 +03:00 committed by LeL
parent 88cefa7c5f
commit 26b8e33ed7

View file

@ -74,14 +74,10 @@ func (db *DB) Lock(cnr cid.ID, locker oid.ID, locked []oid.ID) error {
}
// update the list of lockers
if exLockers == nil {
updLockers = keyLocker
} else {
updLockers, err = encodeList(append(exLockers, keyLocker))
if err != nil {
// maybe continue for the best effort?
return fmt.Errorf("encode list of object lockers: %w", err)
}
updLockers, err = encodeList(append(exLockers, keyLocker))
if err != nil {
// maybe continue for the best effort?
return fmt.Errorf("encode list of object lockers: %w", err)
}
// write updated list of lockers