Merge branch 'beta' into dev
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "tinyformat.h"
|
||||
|
||||
const std::string CURRENCY_UNIT = "ZEC";
|
||||
const std::string CURRENCY_UNIT = "KMD";
|
||||
|
||||
CFeeRate::CFeeRate(const CAmount& nFeePaid, size_t nSize)
|
||||
{
|
||||
|
||||
29
src/main.cpp
29
src/main.cpp
@@ -3810,9 +3810,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
|
||||
uint8_t pubkey33[33]; uint256 hash;
|
||||
// These are checks that are independent of context.
|
||||
hash = block.GetHash();
|
||||
|
||||
// Check that the header is valid (particularly PoW). This is mostly
|
||||
// redundant with the call in AcceptBlockHeader.
|
||||
// Check that the header is valid (particularly PoW). This is mostly redundant with the call in AcceptBlockHeader.
|
||||
if (!CheckBlockHeader(futureblockp,height,pindex,block,state,fCheckPOW))
|
||||
{
|
||||
if ( *futureblockp == 0 )
|
||||
@@ -3996,16 +3994,13 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
|
||||
return true;
|
||||
}
|
||||
|
||||
//static uint256 komodo_requestedhash;
|
||||
//static int32_t komodo_requestedcount;
|
||||
|
||||
bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidationState& state, CBlockIndex** ppindex)
|
||||
{
|
||||
static uint256 zero;
|
||||
const CChainParams& chainparams = Params();
|
||||
AssertLockHeld(cs_main);
|
||||
|
||||
// Check for duplicate
|
||||
// Check for duplicate
|
||||
uint256 hash = block.GetHash();
|
||||
BlockMap::iterator miSelf = mapBlockIndex.find(hash);
|
||||
CBlockIndex *pindex = NULL;
|
||||
@@ -4044,12 +4039,6 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat
|
||||
BlockMap::iterator mi = mapBlockIndex.find(block.hashPrevBlock);
|
||||
if (mi == mapBlockIndex.end())
|
||||
{
|
||||
//fprintf(stderr,"AcceptBlockHeader hashPrevBlock %s not found\n",block.hashPrevBlock.ToString().c_str());
|
||||
/*if ( komodo_requestedhash == zero )
|
||||
{
|
||||
komodo_requestedhash = block.hashPrevBlock;
|
||||
komodo_requestedcount = 0;
|
||||
}*/
|
||||
LogPrintf("AcceptBlockHeader hashPrevBlock %s not found\n",block.hashPrevBlock.ToString().c_str());
|
||||
return(false);
|
||||
//return state.DoS(10, error("%s: prev block not found", __func__), 0, "bad-prevblk");
|
||||
@@ -4057,12 +4046,6 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat
|
||||
pindexPrev = (*mi).second;
|
||||
if (pindexPrev == 0 )
|
||||
{
|
||||
/*fprintf(stderr,"AcceptBlockHeader failed no pindexPrev %s\n",block.hashPrevBlock.ToString().c_str());
|
||||
if ( komodo_requestedhash == zero )
|
||||
{
|
||||
komodo_requestedhash = block.hashPrevBlock;
|
||||
komodo_requestedcount = 0;
|
||||
}*/
|
||||
LogPrintf("AcceptBlockHeader hashPrevBlock %s no pindexPrev\n",block.hashPrevBlock.ToString().c_str());
|
||||
return(false);
|
||||
}
|
||||
@@ -4154,7 +4137,6 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C
|
||||
}
|
||||
|
||||
int nHeight = pindex->nHeight;
|
||||
|
||||
// Write block to history file
|
||||
try {
|
||||
unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
|
||||
@@ -4280,8 +4262,8 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo
|
||||
bool checked; uint256 hash; int32_t futureblock=0;
|
||||
auto verifier = libzcash::ProofVerifier::Disabled();
|
||||
hash = pblock->GetHash();
|
||||
//fprintf(stderr,"process newblock %s\n",hash.ToString().c_str());
|
||||
if ( chainActive.Tip() != 0 )
|
||||
|
||||
if ( chainActive.Tip() != 0 )
|
||||
komodo_currentheight_set(chainActive.Tip()->nHeight);
|
||||
checked = CheckBlock(&futureblock,height!=0?height:komodo_block2height(pblock),0,*pblock, state, verifier,0);
|
||||
{
|
||||
@@ -6164,10 +6146,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
return error("non-continuous headers sequence");
|
||||
}
|
||||
int32_t futureblock;
|
||||
//fprintf(stderr,"headers msg nCount.%d\n",(int32_t)nCount);
|
||||
if (!AcceptBlockHeader(&futureblock,header, state, &pindexLast)) {
|
||||
int nDoS;
|
||||
if (state.IsInvalid(nDoS))
|
||||
if (state.IsInvalid(nDoS) && futureblock == 0)
|
||||
{
|
||||
if (nDoS > 0 && futureblock == 0)
|
||||
Misbehaving(pfrom->GetId(), nDoS/nDoS);
|
||||
|
||||
@@ -921,7 +921,7 @@ UniValue height_MoM(const UniValue& params, bool fHelp)
|
||||
ret.push_back(Pair("kmdendi",kmdendi));
|
||||
}
|
||||
} else ret.push_back(Pair("error",(char *)"no MoM for height"));
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -949,7 +949,7 @@ UniValue txMoMproof(const UniValue& params, bool fHelp)
|
||||
|
||||
if (!depth)
|
||||
throw runtime_error("notarisation not found");
|
||||
|
||||
|
||||
// index of block in MoM leaves
|
||||
nIndex = notarisedHeight - blockIndex->nHeight;
|
||||
}
|
||||
@@ -1004,7 +1004,7 @@ UniValue txMoMproof(const UniValue& params, bool fHelp)
|
||||
}
|
||||
|
||||
// Check the proof
|
||||
if (MoM != CBlock::CheckMerkleBranch(hash, branch, nIndex))
|
||||
if (MoM != CBlock::CheckMerkleBranch(hash, branch, nIndex))
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Failed validating MoM");
|
||||
|
||||
// Encode and return
|
||||
@@ -1103,14 +1103,14 @@ UniValue notaries(const UniValue& params, bool fHelp)
|
||||
for (j=0; j<33; j++)
|
||||
sprintf(&hexstr[j*2],"%02x",pubkeys[i][j]);
|
||||
item.push_back(Pair("pubkey", hex));
|
||||
|
||||
|
||||
bitcoin_address(btcaddr,0,pubkeys[i],33);
|
||||
m = (int32_t)strlen(btcaddr);
|
||||
btcaddress.resize(m);
|
||||
ptr = (char *)btcaddress.data();
|
||||
memcpy(ptr,btcaddr,m);
|
||||
item.push_back(Pair("BTCaddress", btcaddress));
|
||||
|
||||
|
||||
bitcoin_address(kmdaddr,60,pubkeys[i],33);
|
||||
m = (int32_t)strlen(kmdaddr);
|
||||
kmdaddress.resize(m);
|
||||
@@ -1258,8 +1258,8 @@ UniValue gettxout(const UniValue& params, bool fHelp)
|
||||
" \"hex\" : \"hex\", (string) \n"
|
||||
" \"reqSigs\" : n, (numeric) Number of required signatures\n"
|
||||
" \"type\" : \"pubkeyhash\", (string) The type, eg pubkeyhash\n"
|
||||
" \"addresses\" : [ (array of string) array of Zcash addresses\n"
|
||||
" \"zcashaddress\" (string) Zcash address\n"
|
||||
" \"addresses\" : [ (array of string) array of Komodo addresses\n"
|
||||
" \"komodoaddress\" (string) Komodo address\n"
|
||||
" ,...\n"
|
||||
" ]\n"
|
||||
" },\n"
|
||||
|
||||
@@ -182,7 +182,7 @@ UniValue generate(const UniValue& params, bool fHelp)
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Wallet disabled and -mineraddress not set");
|
||||
}
|
||||
#else
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "zcashd compiled without wallet and -mineraddress not set");
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "komodod compiled without wallet and -mineraddress not set");
|
||||
#endif
|
||||
}
|
||||
if (!Params().MineBlocksOnDemand())
|
||||
@@ -304,7 +304,7 @@ UniValue setgenerate(const UniValue& params, bool fHelp)
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Wallet disabled and -mineraddress not set");
|
||||
}
|
||||
#else
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "zcashd compiled without wallet and -mineraddress not set");
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "komodod compiled without wallet and -mineraddress not set");
|
||||
#endif
|
||||
}
|
||||
if (Params().MineBlocksOnDemand())
|
||||
@@ -506,7 +506,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Wallet disabled and -mineraddress not set");
|
||||
}
|
||||
#else
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "zcashd compiled without wallet and -mineraddress not set");
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "komodod compiled without wallet and -mineraddress not set");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
|
||||
|
||||
if (vNodes.empty())
|
||||
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Zcash is not connected!");
|
||||
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Komodo is not connected!");
|
||||
|
||||
//if (IsInitialBlockDownload())
|
||||
// throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Zcash is downloading blocks...");
|
||||
|
||||
@@ -71,7 +71,7 @@ UniValue getinfo(const UniValue& params, bool fHelp)
|
||||
" \"version\": xxxxx, (numeric) the server version\n"
|
||||
" \"protocolversion\": xxxxx, (numeric) the protocol version\n"
|
||||
" \"walletversion\": xxxxx, (numeric) the wallet version\n"
|
||||
" \"balance\": xxxxxxx, (numeric) the total Zcash balance of the wallet\n"
|
||||
" \"balance\": xxxxxxx, (numeric) the total Komodo balance of the wallet\n"
|
||||
" \"blocks\": xxxxxx, (numeric) the current number of blocks processed in the server\n"
|
||||
" \"timeoffset\": xxxxx, (numeric) the time offset\n"
|
||||
" \"connections\": xxxxx, (numeric) the number of connections\n"
|
||||
@@ -287,14 +287,14 @@ UniValue validateaddress(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 1)
|
||||
throw runtime_error(
|
||||
"validateaddress \"zcashaddress\"\n"
|
||||
"\nReturn information about the given Zcash address.\n"
|
||||
"validateaddress \"komodoaddress\"\n"
|
||||
"\nReturn information about the given Komodo address.\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"zcashaddress\" (string, required) The Zcash address to validate\n"
|
||||
"1. \"komodoaddress\" (string, required) The Komodo address to validate\n"
|
||||
"\nResult:\n"
|
||||
"{\n"
|
||||
" \"isvalid\" : true|false, (boolean) If the address is valid or not. If not, this is the only property returned.\n"
|
||||
" \"address\" : \"zcashaddress\", (string) The Zcash address validated\n"
|
||||
" \"address\" : \"komodoaddress\", (string) The Komodo address validated\n"
|
||||
" \"scriptPubKey\" : \"hex\", (string) The hex encoded scriptPubKey generated by the address\n"
|
||||
" \"ismine\" : true|false, (boolean) If the address is yours or not\n"
|
||||
" \"isscript\" : true|false, (boolean) If the key is a script\n"
|
||||
@@ -303,8 +303,8 @@ UniValue validateaddress(const UniValue& params, bool fHelp)
|
||||
" \"account\" : \"account\" (string) DEPRECATED. The account associated with the address, \"\" is the default account\n"
|
||||
"}\n"
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("validateaddress", "\"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"")
|
||||
+ HelpExampleRpc("validateaddress", "\"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"")
|
||||
+ HelpExampleCli("validateaddress", "\"RTZMZHDFSTFQst8XmX2dR4DaH87cEUs3gC\"")
|
||||
+ HelpExampleRpc("validateaddress", "\"RTZMZHDFSTFQst8XmX2dR4DaH87cEUs3gC\"")
|
||||
);
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
@@ -478,9 +478,9 @@ UniValue createmultisig(const UniValue& params, bool fHelp)
|
||||
|
||||
"\nArguments:\n"
|
||||
"1. nrequired (numeric, required) The number of required signatures out of the n keys or addresses.\n"
|
||||
"2. \"keys\" (string, required) A json array of keys which are Zcash addresses or hex-encoded public keys\n"
|
||||
"2. \"keys\" (string, required) A json array of keys which are Komodo addresses or hex-encoded public keys\n"
|
||||
" [\n"
|
||||
" \"key\" (string) Zcash address or hex-encoded public key\n"
|
||||
" \"key\" (string) Komodo address or hex-encoded public key\n"
|
||||
" ,...\n"
|
||||
" ]\n"
|
||||
|
||||
@@ -492,9 +492,9 @@ UniValue createmultisig(const UniValue& params, bool fHelp)
|
||||
|
||||
"\nExamples:\n"
|
||||
"\nCreate a multisig address from 2 addresses\n"
|
||||
+ HelpExampleCli("createmultisig", "2 \"[\\\"t16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\\\",\\\"t171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\\\"]\"") +
|
||||
+ HelpExampleCli("createmultisig", "2 \"[\\\"RTZMZHDFSTFQst8XmX2dR4DaH87cEUs3gC\\\",\\\"RNKiEBduBru6Siv1cZRVhp4fkZNyPska6z\\\"]\"") +
|
||||
"\nAs a json rpc call\n"
|
||||
+ HelpExampleRpc("createmultisig", "2, \"[\\\"t16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\\\",\\\"t171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\\\"]\"")
|
||||
+ HelpExampleRpc("createmultisig", "2, \"[\\\"RTZMZHDFSTFQst8XmX2dR4DaH87cEUs3gC\\\",\\\"RNKiEBduBru6Siv1cZRVhp4fkZNyPska6z\\\"]\"")
|
||||
;
|
||||
throw runtime_error(msg);
|
||||
}
|
||||
@@ -515,10 +515,10 @@ UniValue verifymessage(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 3)
|
||||
throw runtime_error(
|
||||
"verifymessage \"zcashaddress\" \"signature\" \"message\"\n"
|
||||
"verifymessage \"komodoaddress\" \"signature\" \"message\"\n"
|
||||
"\nVerify a signed message\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"zcashaddress\" (string, required) The Zcash address to use for the signature.\n"
|
||||
"1. \"komodoaddress\" (string, required) The Komodo address to use for the signature.\n"
|
||||
"2. \"signature\" (string, required) The signature provided by the signer in base 64 encoding (see signmessage).\n"
|
||||
"3. \"message\" (string, required) The message that was signed.\n"
|
||||
"\nResult:\n"
|
||||
@@ -527,11 +527,11 @@ UniValue verifymessage(const UniValue& params, bool fHelp)
|
||||
"\nUnlock the wallet for 30 seconds\n"
|
||||
+ HelpExampleCli("walletpassphrase", "\"mypassphrase\" 30") +
|
||||
"\nCreate the signature\n"
|
||||
+ HelpExampleCli("signmessage", "\"t14oHp2v54vfmdgQ3v3SNuQga8JKHTNi2a1\" \"my message\"") +
|
||||
+ HelpExampleCli("signmessage", "\"RNKiEBduBru6Siv1cZRVhp4fkZNyPska6z\" \"my message\"") +
|
||||
"\nVerify the signature\n"
|
||||
+ HelpExampleCli("verifymessage", "\"t14oHp2v54vfmdgQ3v3SNuQga8JKHTNi2a1\" \"signature\" \"my message\"") +
|
||||
+ HelpExampleCli("verifymessage", "\"RNKiEBduBru6Siv1cZRVhp4fkZNyPska6z\" \"signature\" \"my message\"") +
|
||||
"\nAs json rpc\n"
|
||||
+ HelpExampleRpc("verifymessage", "\"t14oHp2v54vfmdgQ3v3SNuQga8JKHTNi2a1\", \"signature\", \"my message\"")
|
||||
+ HelpExampleRpc("verifymessage", "\"RNKiEBduBru6Siv1cZRVhp4fkZNyPska6z\", \"signature\", \"my message\"")
|
||||
);
|
||||
|
||||
LOCK(cs_main);
|
||||
|
||||
@@ -294,7 +294,7 @@ UniValue getaddednodeinfo(const UniValue& params, bool fHelp)
|
||||
" \"connected\" : true|false, (boolean) If connected\n"
|
||||
" \"addresses\" : [\n"
|
||||
" {\n"
|
||||
" \"address\" : \"192.168.0.201:8233\", (string) The Zcash server host and port\n"
|
||||
" \"address\" : \"192.168.0.201:8233\", (string) The Komodo server host and port\n"
|
||||
" \"connected\" : \"outbound\" (string) connection, inbound or outbound\n"
|
||||
" }\n"
|
||||
" ,...\n"
|
||||
|
||||
@@ -326,7 +326,7 @@ UniValue getrawtransaction(const UniValue& params, bool fHelp)
|
||||
" \"reqSigs\" : n, (numeric) The required sigs\n"
|
||||
" \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n"
|
||||
" \"addresses\" : [ (json array of string)\n"
|
||||
" \"zcashaddress\" (string) Zcash address\n"
|
||||
" \"komodoaddress\" (string) Komodo address\n"
|
||||
" ,...\n"
|
||||
" ]\n"
|
||||
" }\n"
|
||||
@@ -601,7 +601,7 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
|
||||
" ]\n"
|
||||
"2. \"addresses\" (string, required) a json object with addresses as keys and amounts as values\n"
|
||||
" {\n"
|
||||
" \"address\": x.xxx (numeric, required) The key is the Zcash address, the value is the " + CURRENCY_UNIT + " amount\n"
|
||||
" \"address\": x.xxx (numeric, required) The key is the Komodo address, the value is the " + CURRENCY_UNIT + " amount\n"
|
||||
" ,...\n"
|
||||
" }\n"
|
||||
|
||||
@@ -622,7 +622,7 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
|
||||
int nextBlockHeight = chainActive.Height() + 1;
|
||||
CMutableTransaction rawTx = CreateNewContextualCMutableTransaction(
|
||||
Params().GetConsensus(), nextBlockHeight);
|
||||
|
||||
|
||||
if (NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
|
||||
rawTx.nExpiryHeight = nextBlockHeight + expiryDelta;
|
||||
if (rawTx.nExpiryHeight >= TX_EXPIRY_HEIGHT_THRESHOLD){
|
||||
@@ -652,7 +652,7 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
|
||||
BOOST_FOREACH(const string& name_, addrList) {
|
||||
CBitcoinAddress address(name_);
|
||||
if (!address.IsValid())
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Zcash address: ")+name_);
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Komodo address: ")+name_);
|
||||
|
||||
if (setAddress.count(address))
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+name_);
|
||||
@@ -708,7 +708,7 @@ UniValue decoderawtransaction(const UniValue& params, bool fHelp)
|
||||
" \"reqSigs\" : n, (numeric) The required sigs\n"
|
||||
" \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n"
|
||||
" \"addresses\" : [ (json array of string)\n"
|
||||
" \"t12tvKAXCxZjSmdNbao16dKXC8tRWfcF5oc\" (string) zcash address\n"
|
||||
" \"RTZMZHDFSTFQst8XmX2dR4DaH87cEUs3gC\" (string) komodo address\n"
|
||||
" ,...\n"
|
||||
" ]\n"
|
||||
" }\n"
|
||||
@@ -778,7 +778,7 @@ UniValue decodescript(const UniValue& params, bool fHelp)
|
||||
" \"type\":\"type\", (string) The output type\n"
|
||||
" \"reqSigs\": n, (numeric) The required signatures\n"
|
||||
" \"addresses\": [ (json array of string)\n"
|
||||
" \"address\" (string) Zcash address\n"
|
||||
" \"address\" (string) Komodo address\n"
|
||||
" ,...\n"
|
||||
" ],\n"
|
||||
" \"p2sh\",\"address\" (string) script address\n"
|
||||
|
||||
@@ -242,7 +242,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
||||
|
||||
CValidationState state;
|
||||
|
||||
if (ProcessNewBlock(1,state, NULL, pblock, true, NULL) && state.IsValid()) {
|
||||
if (ProcessNewBlock(1,0,state, NULL, pblock, true, NULL) && state.IsValid()) {
|
||||
goto foundit;
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
||||
*/
|
||||
|
||||
CValidationState state;
|
||||
BOOST_CHECK(ProcessNewBlock(1,state, NULL, pblock, true, NULL));
|
||||
BOOST_CHECK(ProcessNewBlock(1,0,state, NULL, pblock, true, NULL));
|
||||
BOOST_CHECK_MESSAGE(state.IsValid(), state.GetRejectReason());
|
||||
pblock->hashPrevBlock = pblock->GetHash();
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ std::string DecodeDumpString(const std::string &str) {
|
||||
for (unsigned int pos = 0; pos < str.length(); pos++) {
|
||||
unsigned char c = str[pos];
|
||||
if (c == '%' && pos+2 < str.length()) {
|
||||
c = (((str[pos+1]>>6)*9+((str[pos+1]-'0')&15)) << 4) |
|
||||
c = (((str[pos+1]>>6)*9+((str[pos+1]-'0')&15)) << 4) |
|
||||
((str[pos+2]>>6)*9+((str[pos+2]-'0')&15));
|
||||
pos += 2;
|
||||
}
|
||||
@@ -77,13 +77,13 @@ UniValue importprivkey(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() < 1 || params.size() > 3)
|
||||
throw runtime_error(
|
||||
"importprivkey \"zcashprivkey\" ( \"label\" rescan )\n"
|
||||
"importprivkey \"komodoprivkey\" ( \"label\" rescan )\n"
|
||||
"\nAdds a private key (as returned by dumpprivkey) to your wallet.\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"zcashprivkey\" (string, required) The private key (see dumpprivkey)\n"
|
||||
"1. \"komodoprivkey\" (string, required) The private key (see dumpprivkey)\n"
|
||||
"2. \"label\" (string, optional, default=\"\") An optional label\n"
|
||||
"3. rescan (boolean, optional, default=true) Rescan the wallet for transactions\n"
|
||||
"\nNote: This call can take minutes to complete if rescan is true.\n"
|
||||
@@ -152,7 +152,7 @@ UniValue importaddress(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() < 1 || params.size() > 3)
|
||||
throw runtime_error(
|
||||
"importaddress \"address\" ( \"label\" rescan )\n"
|
||||
@@ -248,7 +248,7 @@ UniValue importwallet(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() != 1)
|
||||
throw runtime_error(
|
||||
"importwallet \"filename\"\n"
|
||||
@@ -385,14 +385,14 @@ UniValue dumpprivkey(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() != 1)
|
||||
throw runtime_error(
|
||||
"dumpprivkey \"zcashaddress\"\n"
|
||||
"\nReveals the private key corresponding to 'zcashaddress'.\n"
|
||||
"dumpprivkey \"komodoaddress\"\n"
|
||||
"\nReveals the private key corresponding to 'komodoaddress'.\n"
|
||||
"Then the importprivkey can be used with this output\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"zcashaddress\" (string, required) The zcash address for the private key\n"
|
||||
"1. \"komodoaddress\" (string, required) The komodo address for the private key\n"
|
||||
"\nResult:\n"
|
||||
"\"key\" (string) The private key\n"
|
||||
"\nExamples:\n"
|
||||
@@ -424,13 +424,13 @@ UniValue z_exportwallet(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() != 1)
|
||||
throw runtime_error(
|
||||
"z_exportwallet \"filename\"\n"
|
||||
"\nExports all wallet keys, for taddr and zaddr, in a human-readable format. Overwriting an existing file is not permitted.\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"filename\" (string, required) The filename, saved in folder set by zcashd -exportdir option\n"
|
||||
"1. \"filename\" (string, required) The filename, saved in folder set by komodod -exportdir option\n"
|
||||
"\nResult:\n"
|
||||
"\"path\" (string) The full path of the destination file\n"
|
||||
"\nExamples:\n"
|
||||
@@ -451,7 +451,7 @@ UniValue dumpwallet(const UniValue& params, bool fHelp)
|
||||
"dumpwallet \"filename\"\n"
|
||||
"\nDumps taddr wallet keys in a human-readable format. Overwriting an existing file is not permitted.\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"filename\" (string, required) The filename, saved in folder set by zcashd -exportdir option\n"
|
||||
"1. \"filename\" (string, required) The filename, saved in folder set by komodod -exportdir option\n"
|
||||
"\nResult:\n"
|
||||
"\"path\" (string) The full path of the destination file\n"
|
||||
"\nExamples:\n"
|
||||
@@ -475,7 +475,7 @@ UniValue dumpwallet_impl(const UniValue& params, bool fHelp, bool fDumpZKeys)
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, e.what());
|
||||
}
|
||||
if (exportdir.empty()) {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Cannot export wallet until the zcashd -exportdir option has been set");
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Cannot export wallet until the komodod -exportdir option has been set");
|
||||
}
|
||||
std::string unclean = params[0].get_str();
|
||||
std::string clean = SanitizeFilename(unclean);
|
||||
|
||||
Reference in New Issue
Block a user