Browse Source

Started fixing compilation errors.

cn
Jianping Wu 6 years ago
parent
commit
ec2f335382
  1. 2
      src/keva/common.cpp
  2. 2
      src/keva/common.h
  3. 2
      src/keva/main.h
  4. 4
      src/script/keva.cpp
  5. 4
      src/script/keva.h
  6. 16
      src/wallet/rpckeva.cpp
  7. 6
      src/wallet/rpcwallet.cpp
  8. 2
      src/wallet/rpcwallet.h
  9. 2
      src/wallet/wallet.cpp

2
src/keva/common.cpp

@ -10,6 +10,8 @@ @@ -10,6 +10,8 @@
#include <script/keva.h>
typedef std::vector<unsigned char> valtype;
bool fNameHistory = false;
/* ************************************************************************** */

2
src/keva/common.h

@ -21,6 +21,8 @@ @@ -21,6 +21,8 @@
class CKevaScript;
class CDBBatch;
typedef std::vector<unsigned char> valtype;
/** Whether or not name history is enabled. */
extern bool fNameHistory;

2
src/keva/main.h

@ -28,6 +28,8 @@ class CTxMemPool; @@ -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;

4
src/script/keva.cpp

@ -72,11 +72,11 @@ CKevaScript::buildKevaPut(const CScript& addr, const valtype& nameSpace, @@ -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;
}

4
src/script/keva.h

@ -7,6 +7,8 @@ @@ -7,6 +7,8 @@
#include <script/script.h>
typedef std::vector<unsigned char> valtype;
class uint160;
/**
@ -191,7 +193,7 @@ public: @@ -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);
/**

16
src/wallet/rpckeva.cpp

@ -63,16 +63,22 @@ keva_namespace (const JSONRPCRequest& request) @@ -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();

6
src/wallet/rpcwallet.cpp

@ -428,7 +428,7 @@ static void SendMoney(CWallet * const pwallet, const CTxDestination &address, CA @@ -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) @@ -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[] = @@ -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"} }
};

2
src/wallet/rpcwallet.h

@ -7,8 +7,10 @@ @@ -7,8 +7,10 @@
#include <string>
class CCoinControl;
class CRPCTable;
class CWallet;
class CWalletTx;
class JSONRPCRequest;
void RegisterWalletRPCCommands(CRPCTable &t);

2
src/wallet/wallet.cpp

@ -2603,7 +2603,7 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, int& nC @@ -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…
Cancel
Save