Skip to content
This repository was archived by the owner on Feb 4, 2026. It is now read-only.

Commit 4060058

Browse files
authored
fix delete private key from mockStub (#37)
1 parent 9d9c9cc commit 4060058

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

testing/mockstub.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,7 @@ func (stub *MockStub) DelPrivateData(collection string, key string) error {
466466
return errors.Errorf("Collection %s not found.", collection)
467467
}
468468

469-
if _, ok := m[key]; !ok {
470-
return errors.Errorf("Key %s not found.", key)
471-
}
469+
// If m is nil or there is no such element, delete is a no-op.
472470
delete(m, key)
473471

474472
for elem := stub.PrivateKeys[collection].Front(); elem != nil; elem = elem.Next() {

0 commit comments

Comments
 (0)