Deletion of _KEVA_NS_ is not allowed.

This commit is contained in:
Just Wonder 2020-06-20 21:17:23 -07:00
parent e203aa1835
commit 1cc2e03927
2 changed files with 11 additions and 0 deletions

View File

@ -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;
{

View File

@ -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()