Browse Source

Deletion of _KEVA_NS_ is not allowed.

views
Just Wonder 4 years ago
parent
commit
1cc2e03927
  1. 4
      src/wallet/rpckeva.cpp
  2. 7
      test/functional/feature_keva.py

4
src/wallet/rpckeva.cpp

@ -327,6 +327,10 @@ UniValue keva_delete(const JSONRPCRequest& request) @@ -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;
{

7
test/functional/feature_keva.py

@ -282,6 +282,13 @@ class KevaTest(BitcoinTestFramework): @@ -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()

Loading…
Cancel
Save