mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-14 00:58:09 +00:00
Started fixing compilation errors.
This commit is contained in:
parent
fb0acfc6d9
commit
ec2f335382
@ -10,6 +10,8 @@
|
||||
|
||||
#include <script/keva.h>
|
||||
|
||||
typedef std::vector<unsigned char> valtype;
|
||||
|
||||
bool fNameHistory = false;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
@ -21,6 +21,8 @@
|
||||
class CKevaScript;
|
||||
class CDBBatch;
|
||||
|
||||
typedef std::vector<unsigned char> valtype;
|
||||
|
||||
/** Whether or not name history is enabled. */
|
||||
extern bool fNameHistory;
|
||||
|
||||
|
@ -28,6 +28,8 @@ class CTxMemPool;
|
||||
class CTxMemPoolEntry;
|
||||
class CValidationState;
|
||||
|
||||
typedef std::vector<unsigned char> valtype;
|
||||
|
||||
/* Some constants defining namespace, key and value limits. */
|
||||
static const unsigned MAX_NAMESPACE_LENGTH = 255;
|
||||
static const unsigned MAX_KEY_LENGTH = 255;
|
||||
|
@ -72,11 +72,11 @@ CKevaScript::buildKevaPut(const CScript& addr, const valtype& nameSpace,
|
||||
return prefix + addr;
|
||||
}
|
||||
|
||||
CScript CKevaScript::buildKevaNamespace(const CScript& addr, const valtype& nameSpace,
|
||||
CScript CKevaScript::buildKevaNamespace(const CScript& addr, const uint160& nameSpace,
|
||||
const valtype& displayName)
|
||||
{
|
||||
CScript prefix;
|
||||
prefix << OP_KEVA_NAMESPACE << nameSpace << displayName << OP_2DROP;
|
||||
prefix << OP_KEVA_NAMESPACE << ToByteVector(nameSpace) << displayName << OP_2DROP;
|
||||
|
||||
return prefix + addr;
|
||||
}
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
#include <script/script.h>
|
||||
|
||||
typedef std::vector<unsigned char> valtype;
|
||||
|
||||
class uint160;
|
||||
|
||||
/**
|
||||
@ -191,7 +193,7 @@ public:
|
||||
* @param hash The hash to use.
|
||||
* @return The full KEVA_NAMESPACE script.
|
||||
*/
|
||||
static CScript buildKevaNamespace(const CScript& addr, const valtype& nameSpace,
|
||||
static CScript buildKevaNamespace(const CScript& addr, const uint160& nameSpace,
|
||||
const valtype& displayName);
|
||||
|
||||
/**
|
||||
|
@ -63,16 +63,22 @@ keva_namespace (const JSONRPCRequest& request)
|
||||
|
||||
CReserveKey keyName(pwallet);
|
||||
CPubKey pubKey;
|
||||
const bool ok = keyName.GetReservedKey (pubKey, true);
|
||||
const bool ok = keyName.GetReservedKey(pubKey, true);
|
||||
assert (ok);
|
||||
const CScript addrName = GetScriptForDestination(pubKey.GetID());
|
||||
const CScript newScript = CKevaScript::buildKevaNamespace(addrName, namespaceHash, displayName);
|
||||
|
||||
//const uint160 hash = Hash160(toHash);
|
||||
CKeyID keyId = pubKey.GetID()
|
||||
|
||||
// The namespace is: Hash160(Hash160(keyId) || displayName)
|
||||
valtype toHash = ToByteVector(Hash160(ToByteVector(keyId)));
|
||||
toHash.insert(toHash.end(), displayName.begin(), displayName.end());
|
||||
const uint160 namespaceHash = Hash160(toHash);
|
||||
|
||||
const CScript addrName = GetScriptForDestination(keyId);
|
||||
const CScript newScript = CKevaScript::buildKevaNamespace(addrName, namespaceHash, displayName);
|
||||
|
||||
CCoinControl coinControl;
|
||||
CWalletTx wtx;
|
||||
SendMoneyToScript (pwallet, newScript, nullptr,
|
||||
SendMoneyToScript(pwallet, newScript, nullptr,
|
||||
NAME_LOCKED_AMOUNT, false, wtx, coinControl);
|
||||
|
||||
keyName.KeepKey();
|
||||
|
@ -428,7 +428,7 @@ static void SendMoney(CWallet * const pwallet, const CTxDestination &address, CA
|
||||
int nChangePosRet = -1;
|
||||
CRecipient recipient = {scriptPubKey, nValue, fSubtractFeeFromAmount};
|
||||
vecSend.push_back(recipient);
|
||||
if (!pwallet->CreateTransaction(vecSend, wtxNew, reservekey, nFeeRequired, nChangePosRet, strError, coin_control)) {
|
||||
if (!pwallet->CreateTransaction(vecSend, nullptr, wtxNew, reservekey, nFeeRequired, nChangePosRet, strError, coin_control)) {
|
||||
if (!fSubtractFeeFromAmount && nValue + nFeeRequired > curBalance)
|
||||
strError = strprintf("Error: This transaction requires a transaction fee of at least %s", FormatMoney(nFeeRequired));
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, strError);
|
||||
@ -1200,7 +1200,7 @@ UniValue sendmany(const JSONRPCRequest& request)
|
||||
CAmount nFeeRequired = 0;
|
||||
int nChangePosRet = -1;
|
||||
std::string strFailReason;
|
||||
bool fCreated = pwallet->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired, nChangePosRet, strFailReason, coin_control);
|
||||
bool fCreated = pwallet->CreateTransaction(vecSend, nullptr, wtx, keyChange, nFeeRequired, nChangePosRet, strFailReason, coin_control);
|
||||
if (!fCreated)
|
||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason);
|
||||
CValidationState state;
|
||||
@ -3643,7 +3643,7 @@ static const CRPCCommand commands[] =
|
||||
{ "generating", "generate", &generate, {"nblocks","maxtries"} },
|
||||
|
||||
// Kevacoin-specific wallet calls.
|
||||
{ "kevacoin", "keva_namespace", &keva_namespace, {"namespace", "key", "value", "create_namespace"} }
|
||||
{ "kevacoin", "keva_namespace", &keva_namespace, {"namespace", "key", "value", "create_namespace"} },
|
||||
{ "kevacoin", "keva_put", &keva_put, {"namespace", "key", "value", "put_value"} }
|
||||
};
|
||||
|
||||
|
@ -7,8 +7,10 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
class CCoinControl;
|
||||
class CRPCTable;
|
||||
class CWallet;
|
||||
class CWalletTx;
|
||||
class JSONRPCRequest;
|
||||
|
||||
void RegisterWalletRPCCommands(CRPCTable &t);
|
||||
|
@ -2603,7 +2603,7 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, int& nC
|
||||
|
||||
CReserveKey reservekey(this);
|
||||
CWalletTx wtx;
|
||||
if (!CreateTransaction(vecSend, wtx, reservekey, nFeeRet, nChangePosInOut, strFailReason, coinControl, false)) {
|
||||
if (!CreateTransaction(vecSend, nullptr, wtx, reservekey, nFeeRet, nChangePosInOut, strFailReason, coinControl, false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user