diff --git a/src/wallet/rpckeva.cpp b/src/wallet/rpckeva.cpp index a690e9a87..c369ac977 100644 --- a/src/wallet/rpckeva.cpp +++ b/src/wallet/rpckeva.cpp @@ -327,6 +327,10 @@ UniValue keva_delete(const JSONRPCRequest& request) throw JSONRPCError (RPC_INVALID_PARAMETER, "the key is too long"); } + if (keyStr == CKevaScript::KEVA_DISPLAY_NAME_KEY) { + throw JSONRPCError (RPC_INVALID_PARAMETER, "_KEVA_NS_ cannot be deleted"); + } + bool hasKey = false; CKevaData data; { diff --git a/test/functional/feature_keva.py b/test/functional/feature_keva.py index f84a22aaa..a33f14976 100755 --- a/test/functional/feature_keva.py +++ b/test/functional/feature_keva.py @@ -282,6 +282,13 @@ class KevaTest(BitcoinTestFramework): response = self.nodes[0].keva_get(namespaceId, keyToDelete) assert(response['value'] == newValue) + try: + self.nodes[0].keva_delete(namespaceId, "_KEVA_NS_") + except JSONRPCException: + pass + else: + raise Exception("Should not be able to delete _KEVA_NS_") + self.log.info("Test disconnecting blocks") self.run_test_disconnect_block()