[#525] morph/container: Accept RemovalWitness in Delete function

Make `wrapper.Delete` function to accept `container.RemovalWitness` struct
instead of its separated elements. `Signature` type is replaced by binary
signature since public key is unused.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-05-26 13:34:06 +03:00 committed by Leonard Lyubich
parent d691a20d52
commit 9a0964efa4
2 changed files with 14 additions and 7 deletions

View file

@ -150,15 +150,16 @@ func (w *Wrapper) Get(cid []byte) (*container.Container, error) {
}
// Delete marshals container ID, and passes it to Wrapper's Delete method
// along with sig.Key() and sig.Sign().
// along with signature.
//
// Returns error if cid is nil.
func Delete(w *Wrapper, cid *container.ID, sig *pkg.Signature) error {
if cid == nil {
// Returns error if container ID is nil.
func Delete(w *Wrapper, witness core.RemovalWitness) error {
id := witness.ContainerID()
if id == nil {
return errNilArgument
}
return w.Delete(cid.ToV2().GetValue(), sig.Sign())
return w.Delete(id.ToV2().GetValue(), witness.Signature())
}
// Delete removes the container from NeoFS system