mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-02-10 14:14:30 +00:00
Used DecodeBase58Check to match EncodeBase58Check.
Max value length is MAX_SCRIPT_ELEMENT_SIZE.
This commit is contained in:
parent
e30e56ef11
commit
f947286c8b
@ -10,6 +10,7 @@
|
|||||||
#define H_BITCOIN_KEVA_MAIN
|
#define H_BITCOIN_KEVA_MAIN
|
||||||
|
|
||||||
#include <amount.h>
|
#include <amount.h>
|
||||||
|
#include <script/script.h>
|
||||||
#include <keva/common.h>
|
#include <keva/common.h>
|
||||||
#include <primitives/transaction.h>
|
#include <primitives/transaction.h>
|
||||||
#include <serialize.h>
|
#include <serialize.h>
|
||||||
@ -33,7 +34,7 @@ typedef std::vector<unsigned char> valtype;
|
|||||||
/* Some constants defining namespace, key and value limits. */
|
/* Some constants defining namespace, key and value limits. */
|
||||||
static const unsigned MAX_NAMESPACE_LENGTH = 255;
|
static const unsigned MAX_NAMESPACE_LENGTH = 255;
|
||||||
static const unsigned MAX_KEY_LENGTH = 255;
|
static const unsigned MAX_KEY_LENGTH = 255;
|
||||||
static const unsigned MAX_VALUE_LENGTH = 1023;
|
static const unsigned MAX_VALUE_LENGTH = MAX_SCRIPT_ELEMENT_SIZE; // As defined in script.h
|
||||||
|
|
||||||
/** The amount of coins to lock in created transactions. */
|
/** The amount of coins to lock in created transactions. */
|
||||||
static const CAmount KEVA_LOCKED_AMOUNT = COIN / 100;
|
static const CAmount KEVA_LOCKED_AMOUNT = COIN / 100;
|
||||||
|
@ -226,7 +226,7 @@ UniValue keva_put(const JSONRPCRequest& request)
|
|||||||
|
|
||||||
const std::string namespaceStr = request.params[0].get_str();
|
const std::string namespaceStr = request.params[0].get_str();
|
||||||
valtype nameSpace;
|
valtype nameSpace;
|
||||||
if (!DecodeBase58(namespaceStr, nameSpace)) {
|
if (!DecodeBase58Check(namespaceStr, nameSpace)) {
|
||||||
throw JSONRPCError (RPC_INVALID_PARAMETER, "failed to decode namespace");
|
throw JSONRPCError (RPC_INVALID_PARAMETER, "failed to decode namespace");
|
||||||
}
|
}
|
||||||
if (nameSpace.size () > MAX_NAMESPACE_LENGTH)
|
if (nameSpace.size () > MAX_NAMESPACE_LENGTH)
|
||||||
@ -307,7 +307,7 @@ UniValue keva_get(const JSONRPCRequest& request)
|
|||||||
|
|
||||||
const std::string namespaceStr = request.params[0].get_str ();
|
const std::string namespaceStr = request.params[0].get_str ();
|
||||||
valtype nameSpace;
|
valtype nameSpace;
|
||||||
if (!DecodeBase58(namespaceStr, nameSpace)) {
|
if (!DecodeBase58Check(namespaceStr, nameSpace)) {
|
||||||
throw JSONRPCError (RPC_INVALID_PARAMETER, "failed to decode namespace");
|
throw JSONRPCError (RPC_INVALID_PARAMETER, "failed to decode namespace");
|
||||||
}
|
}
|
||||||
if (nameSpace.size () > MAX_NAMESPACE_LENGTH)
|
if (nameSpace.size () > MAX_NAMESPACE_LENGTH)
|
||||||
@ -372,7 +372,7 @@ UniValue keva_pending(const JSONRPCRequest& request)
|
|||||||
if (request.params.size() == 1) {
|
if (request.params.size() == 1) {
|
||||||
RPCTypeCheckArgument(request.params[0], UniValue::VSTR);
|
RPCTypeCheckArgument(request.params[0], UniValue::VSTR);
|
||||||
namespaceStr = request.params[0].get_str();
|
namespaceStr = request.params[0].get_str();
|
||||||
if (!DecodeBase58(namespaceStr, nameSpace)) {
|
if (!DecodeBase58Check(namespaceStr, nameSpace)) {
|
||||||
throw JSONRPCError (RPC_INVALID_PARAMETER, "failed to decode namespace");
|
throw JSONRPCError (RPC_INVALID_PARAMETER, "failed to decode namespace");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user