From 40600581e0a70eddaaf2b29ceb3d5ee4b98fd1c7 Mon Sep 17 00:00:00 2001 From: Evgeniy <78333450+SiriusPluge@users.noreply.github.com> Date: Tue, 9 Jan 2024 11:24:11 +0200 Subject: [PATCH] fix delete private key from mockStub (#37) --- testing/mockstub.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/testing/mockstub.go b/testing/mockstub.go index 71228f0..3730141 100644 --- a/testing/mockstub.go +++ b/testing/mockstub.go @@ -466,9 +466,7 @@ func (stub *MockStub) DelPrivateData(collection string, key string) error { return errors.Errorf("Collection %s not found.", collection) } - if _, ok := m[key]; !ok { - return errors.Errorf("Key %s not found.", key) - } + // If m is nil or there is no such element, delete is a no-op. delete(m, key) for elem := stub.PrivateKeys[collection].Front(); elem != nil; elem = elem.Next() {