diff --git a/configure.ac b/configure.ac index 12256c0cc..3bf9abf8c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,13 +1,13 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) -define(_CLIENT_VERSION_MAJOR, 2) +define(_CLIENT_VERSION_MAJOR, 3) define(_CLIENT_VERSION_MINOR, 0) -define(_CLIENT_VERSION_REVISION, 15) -define(_CLIENT_VERSION_BUILD, 26) +define(_CLIENT_VERSION_REVISION, 0) +define(_CLIENT_VERSION_BUILD, 1) define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50))) define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1))) define(_CLIENT_VERSION_IS_RELEASE, true) -define(_COPYRIGHT_YEAR, 2018) +define(_COPYRIGHT_YEAR, 2019) AC_INIT([Verus-CLI],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_SUFFIX(_ZC_BUILD_VAL)],[https://github.com/VerusCoin/VerusCoin/issues],[verus-cli]) AC_CONFIG_SRCDIR([src/main.cpp]) AC_CONFIG_HEADERS([src/config/bitcoin-config.h]) diff --git a/doc/man/komodo-cli.1 b/doc/man/komodo-cli.1 index b7fdd19d6..4c20f0fde 100644 --- a/doc/man/komodo-cli.1 +++ b/doc/man/komodo-cli.1 @@ -1,12 +1,12 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH KOMODO-CLI "1" "March 2018" "komodo-cli v1.0.8" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. +.TH KOMODO-CLI "1" "June 2019" "komodo-cli v3.0.0" "User Commands" .SH NAME -komodo-cli \- manual page for komodo-cli v1.0.8 +komodo-cli \- manual page for komodo-cli v3.0.0 .SH DESCRIPTION -Komodo RPC client version v1.0.8 +Komodo RPC client version v3.0.0\-beta2\-ab9d87166\-dirty .PP -In order to ensure you are adequately protecting your privacy when using Zcash, -please see . +In order to ensure you are adequately protecting your privacy when using Hush, +please see . .SS "Usage:" .TP komodo\-cli [options] [params] @@ -65,14 +65,21 @@ Password for JSON\-RPC connections .IP Timeout in seconds during HTTP requests, or 0 for no timeout. (default: 900) +.HP +\fB\-stdin\fR +.IP +Read extra arguments from standard input, one per line until EOF/Ctrl\-D +(recommended for sensitive information such as passphrases) .SH COPYRIGHT -In order to ensure you are adequately protecting your privacy when using Zcash, -please see . +In order to ensure you are adequately protecting your privacy when using Hush, +please see . -Copyright (C) 2009-2017 The Bitcoin Core Developers -Copyright (C) 2015-2017 The Zcash Developers -Copyright (C) 2015-2017 jl777 and SuperNET developers +Copyright (C) 2009-2019 The Bitcoin Core Developers +Copyright (C) 2015-2019 The Zcash Developers +Copyright (C) 2015-2019 jl777 and SuperNET developers +Copyright (C) 2018-2019 The Hush developers +Copyright (C) 2018-2019 The Verus developers This is experimental software. @@ -81,4 +88,4 @@ or . This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit and cryptographic software written -by Eric Young and UPnP software written by Thomas Bernard. +by Eric Young. diff --git a/doc/man/komodo-tx.1 b/doc/man/komodo-tx.1 index 16f4e9a8d..899b0ce93 100644 --- a/doc/man/komodo-tx.1 +++ b/doc/man/komodo-tx.1 @@ -1,9 +1,9 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH KOMODO-TX "1" "March 2018" "komodo-tx v1.0.8" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. +.TH KOMODO-TX "1" "June 2019" "komodo-tx v3.0.0" "User Commands" .SH NAME -komodo-tx \- manual page for komodo-tx v1.0.8 +komodo-tx \- manual page for komodo-tx v3.0.0 .SH DESCRIPTION -Zcash zcash\-tx utility version v1.0.8 +Zcash zcash\-tx utility version v3.0.0\-beta2\-ab9d87166\-dirty .SS "Usage:" .TP zcash\-tx [options] [commands] @@ -48,7 +48,7 @@ delout=N .IP Delete output N from TX .IP -in=TXID:VOUT +in=TXID:VOUT(:SEQUENCE_NUMBER) .IP Add input to TX .IP @@ -68,7 +68,7 @@ outscript=VALUE:SCRIPT .IP Add raw script output to TX .IP -sign=SIGHASH\-FLAGS +sign=HEIGHT:SIGHASH\-FLAGS .IP Add zero or more signatures to transaction. This command requires JSON registers:prevtxs=JSON object, privatekeys=JSON object. See @@ -85,12 +85,14 @@ set=NAME:JSON\-STRING Set register NAME to given JSON\-STRING .SH COPYRIGHT -In order to ensure you are adequately protecting your privacy when using Zcash, -please see . +In order to ensure you are adequately protecting your privacy when using Hush, +please see . -Copyright (C) 2009-2017 The Bitcoin Core Developers -Copyright (C) 2015-2017 The Zcash Developers -Copyright (C) 2015-2017 jl777 and SuperNET developers +Copyright (C) 2009-2019 The Bitcoin Core Developers +Copyright (C) 2015-2019 The Zcash Developers +Copyright (C) 2015-2019 jl777 and SuperNET developers +Copyright (C) 2018-2019 The Hush developers +Copyright (C) 2018-2019 The Verus developers This is experimental software. @@ -99,4 +101,4 @@ or . This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit and cryptographic software written -by Eric Young and UPnP software written by Thomas Bernard. +by Eric Young. diff --git a/doc/man/komodod.1 b/doc/man/komodod.1 index 4c728657d..9a8dd439a 100644 --- a/doc/man/komodod.1 +++ b/doc/man/komodod.1 @@ -1,12 +1,12 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH KOMODOD "1" "March 2018" "komodod v1.0.8" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. +.TH KOMODOD "1" "June 2019" "komodod v3.0.0" "User Commands" .SH NAME -komodod \- manual page for komodod v1.0.8 +komodod \- manual page for komodod v3.0.0 .SH DESCRIPTION -Komodo Daemon version v1.0.8 +Komodo Daemon version v3.0.0\-beta2\-ab9d87166\-dirty .PP -In order to ensure you are adequately protecting your privacy when using Zcash, -please see . +In order to ensure you are adequately protecting your privacy when using Hush, +please see . .SS "Usage:" .TP komodod [options] @@ -39,6 +39,10 @@ How many blocks to check at startup (default: 288, 0 = all) .IP How thorough the block verification of \fB\-checkblocks\fR is (0\-4, default: 3) .HP +\fB\-clientname=\fR +.IP +Full node client name, default 'MagicBean' +.HP \fB\-conf=\fR .IP Specify configuration file (default: komodo.conf) @@ -57,7 +61,7 @@ Specify directory to be used when exporting data .HP \fB\-dbcache=\fR .IP -Set database cache size in megabytes (4 to 16384, default: 100) +Set database cache size in megabytes (4 to 16384, default: 450) .HP \fB\-loadblock=\fR .IP @@ -67,9 +71,15 @@ Imports blocks from external blk000??.dat file on startup .IP Keep at most unconnectable transactions in memory (default: 100) .HP +\fB\-mempooltxinputlimit=\fR +.IP +[DEPRECATED FROM OVERWINTER] Set the maximum number of transparent +inputs in a transaction that the mempool will accept (default: 0 = no +limit applied) +.HP \fB\-par=\fR .IP -Set the number of script verification threads (\fB\-2\fR to 16, 0 = auto, <0 = +Set the number of script verification threads (\fB\-8\fR to 16, 0 = auto, <0 = leave that many cores free, default: 0) .HP \fB\-pid=\fR @@ -97,6 +107,21 @@ Create new files with system default permissions, instead of umask 077 .IP Maintain a full transaction index, used by the getrawtransaction rpc call (default: 0) +.HP +\fB\-addressindex\fR +.IP +Maintain a full address index, used to query for the balance, txids and +unspent outputs for addresses (default: 0) +.HP +\fB\-timestampindex\fR +.IP +Maintain a timestamp index for block hashes, used to query blocks hashes +by a range of timestamps (default: 0) +.HP +\fB\-spentindex\fR +.IP +Maintain a full spent index, used to query the spending txid and input +index for an outpoint (default: 0) .PP Connection options: .HP @@ -154,7 +179,7 @@ Automatically create Tor hidden service (default: 1) .HP \fB\-maxconnections=\fR .IP -Maintain at most connections to peers (default: 125) +Maintain at most connections to peers (default: 384) .HP \fB\-maxreceivebuffer=\fR .IP @@ -177,6 +202,11 @@ Only connect to nodes in network (ipv4, ipv6 or onion) .IP Relay non\-P2SH multisig (default: 1) .HP +\fB\-peerbloomfilters\fR +.IP +Support filtering of blocks and transaction with Bloom filters (default: +1) +.HP \fB\-port=\fR .IP Listen for connections on (default: 7770 or testnet: 17770) @@ -207,10 +237,6 @@ Tor control port to use if onion listening enabled (default: .IP Tor control port password (default: empty) .HP -\fB\-upnp\fR -.IP -Use UPnP to map the listening port (default: 0) -.HP \fB\-whitebind=\fR .IP Bind to given address and whitelist peers connecting to it. Use @@ -235,11 +261,11 @@ Set key pool size to (default: 100) .HP \fB\-paytxfee=\fR .IP -Fee (in BTC/kB) to add to transactions you send (default: 0.00) +Fee (in KMD/kB) to add to transactions you send (default: 0.00) .HP \fB\-rescan\fR .IP -Rescan the blockchain for missing wallet transactions on startup +Rescan the block chain for missing wallet transactions on startup .HP \fB\-salvagewallet\fR .IP @@ -258,10 +284,15 @@ Spend unconfirmed change when sending transactions (default: 1) If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: 2) .HP +\fB\-txexpirydelta\fR +.IP +Set the number of blocks after which a transaction that has not been +mined will become invalid (default: 200) +.HP \fB\-maxtxfee=\fR .IP -Maximum total fees to use in a single wallet transaction; setting this -too low may abort large transactions (default: 0.10) +Maximum total fees (in KMD) to use in a single wallet transaction; +setting this too low may abort large transactions (default: 0.10) .HP \fB\-upgradewallet\fR .IP @@ -280,6 +311,16 @@ Make the wallet broadcast transactions (default: 1) Execute command when a wallet transaction changes (%s in cmd is replaced by TxID) .HP +\fB\-whitelistaddress=\fR +.IP +Enable the wallet filter for notary nodes and add one Raddress to the +whitelist of the wallet filter. If \fB\-whitelistaddress=\fR is used, then the +wallet filter is automatically activated. Several Raddresses can be +defined using several \fB\-whitelistaddress=\fR (similar to \fB\-addnode\fR). The +wallet filter will filter the utxo to only ones coming from my own +Raddress (derived from pubkey) and each Raddress defined using +\fB\-whitelistaddress=\fR this option is mostly for Notary Nodes). +.HP \fB\-zapwallettxes=\fR .IP Delete all wallet transactions and only recover those parts of the @@ -333,7 +374,7 @@ Prepend debug output with timestamp (default: 1) .HP \fB\-minrelaytxfee=\fR .IP -Fees (in BTC/Kb) smaller than this are considered zero fee for relaying +Fees (in KMD/kB) smaller than this are considered zero fee for relaying (default: 0.000001) .HP \fB\-printtoconsole\fR @@ -376,14 +417,18 @@ Set maximum size of high\-priority/low\-fee transactions in bytes .PP Mining options: .HP +\fB\-mint\fR +.IP +Mint/stake coins automatically (default: 0) +.HP \fB\-gen\fR .IP -Generate coins (default: 0) +Mine/generate coins (default: 0) .HP \fB\-genproclimit=\fR .IP -Set the number of threads for coin generation if enabled (\fB\-1\fR = all -cores, default: 1) +Set the number of threads for coin mining if enabled (\fB\-1\fR = all cores, +default: 0) .HP \fB\-equihashsolver=\fR .IP @@ -453,14 +498,134 @@ output (default: 1 if running in a console, 0 otherwise) .IP Number of seconds between metrics refreshes (default: 1 if running in a console, 600 otherwise) +.PP +Komodo Asset Chain options: +.HP +\fB\-ac_algo\fR +.IP +Choose PoW mining algorithm, default is Equihash +.HP +\fB\-ac_blocktime\fR +.IP +Block time in seconds, default is 60 +.HP +\fB\-ac_cc\fR +.IP +Cryptoconditions, default 0 +.HP +\fB\-ac_beam\fR +.IP +BEAM integration +.HP +\fB\-ac_coda\fR +.IP +CODA integration +.HP +\fB\-ac_cclib\fR +.IP +Cryptoconditions dynamicly loadable library +.HP +\fB\-ac_ccenable\fR +.IP +Cryptoconditions to enable +.HP +\fB\-ac_ccactivate\fR +.IP +Block height to enable Cryptoconditions +.HP +\fB\-ac_decay\fR +.IP +Percentage of block reward decrease at each halving +.HP +\fB\-ac_end\fR +.IP +Block height at which block rewards will end +.HP +\fB\-ac_eras\fR +.IP +Block reward eras +.HP +\fB\-ac_founders\fR +.IP +Number of blocks between founders reward payouts +.HP +\fB\-ac_halving\fR +.IP +Number of blocks between each block reward halving +.HP +\fB\-ac_name\fR +.IP +Name of asset chain +.HP +\fB\-ac_notarypay\fR +.IP +Pay notaries, default 0 +.HP +\fB\-ac_perc\fR +.IP +Percentage of block rewards paid to the founder +.HP +\fB\-ac_private\fR +.IP +Shielded transactions only (except coinbase + notaries), default is 0 +.HP +\fB\-ac_pubkey\fR +.IP +Public key for receiving payments on the network +.HP +\fB\-ac_public\fR +.IP +Transparent transactions only, default 0 +.HP +\fB\-ac_reward\fR +.IP +Block reward in satoshis, default is 0 +.HP +\fB\-ac_sapling\fR +.IP +Sapling activation block height +.HP +\fB\-ac_script\fR +.IP +P2SH/multisig address to receive founders rewards +.HP +\fB\-ac_staked\fR +.IP +Percentage of blocks that are Proof\-Of\-Stake, default 0 +.HP +\fB\-ac_supply\fR +.IP +Starting supply, default is 0 +.HP +\fB\-ac_timelockfrom\fR +.IP +Timelocked coinbase start height +.HP +\fB\-ac_timelockgte\fR +.IP +Timelocked coinbase minimum amount to be locked +.HP +\fB\-ac_timelockto\fR +.IP +Timelocked coinbase stop height +.HP +\fB\-ac_txpow\fR +.IP +Enforce transaction\-rate limit, default 0 +.HP +\fB\-ac_veruspos\fR +.IP +Use Verus Proof\-Of\-Stake (\fB\-ac_veruspos\fR=\fI\,50\/\fR) default 0 .SH COPYRIGHT -In order to ensure you are adequately protecting your privacy when using Zcash, -please see . +In order to ensure you are adequately protecting your privacy when using Hush, +please see . -Copyright (C) 2009-2017 The Bitcoin Core Developers -Copyright (C) 2015-2017 The Zcash Developers -Copyright (C) 2015-2017 jl777 and SuperNET developers +Copyright (C) 2009-2019 The Bitcoin Core Developers +Copyright (C) 2015-2019 The Zcash Developers +Copyright (C) 2015-2019 jl777 and SuperNET developers +Copyright (C) 2018-2019 The Hush developers +Copyright (C) 2018-2019 The Verus developers This is experimental software. @@ -469,4 +634,4 @@ or . This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit and cryptographic software written -by Eric Young and UPnP software written by Thomas Bernard. +by Eric Young. diff --git a/src/cc/CCOracles.h b/src/cc/CCOracles.h index 9f6a35966..2f2b702f4 100644 --- a/src/cc/CCOracles.h +++ b/src/cc/CCOracles.h @@ -26,6 +26,7 @@ std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee); std::string OracleSubscribe(int64_t txfee,uint256 oracletxid,CPubKey publisher,int64_t amount); std::string OracleData(int64_t txfee,uint256 oracletxid,std::vector data); // CCcustom +UniValue OracleDataSample(uint256 reforacletxid,uint256 txid); UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num); UniValue OracleInfo(uint256 origtxid); UniValue OraclesList(); diff --git a/src/cc/oracles.cpp b/src/cc/oracles.cpp index 193f66a1a..bdd01ccfa 100644 --- a/src/cc/oracles.cpp +++ b/src/cc/oracles.cpp @@ -638,11 +638,7 @@ bool OraclesDataValidate(struct CCcontract_info *cp,Eval* eval,const CTransactio int32_t GetLatestTimestamp(int32_t height) { - uint256 blockHash; CBlock block; CBlockIndex* pindex; - - blockHash = chainActive[height]->GetBlockHash(); - pindex = mapBlockIndex[blockHash]; - return(pindex->nTime); + return(komodo_heightstamp(height)); } bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn) @@ -1059,6 +1055,38 @@ UniValue OracleFormat(uint8_t *data,int32_t datalen,char *format,int32_t formatl return(obj); } +UniValue OracleDataSample(uint256 reforacletxid,uint256 txid) +{ + UniValue result(UniValue::VOBJ); CTransaction tx,oracletx; uint256 hashBlock,btxid,oracletxid; std::string error; + CPubKey pk; std::string name,description,format; int32_t numvouts; std::vector data; char str[67], *formatstr = 0; + + result.push_back(Pair("result","success")); + if ( GetTransaction(reforacletxid,oracletx,hashBlock,false) != 0 && (numvouts=oracletx.vout.size()) > 0 ) + { + if ( DecodeOraclesCreateOpRet(oracletx.vout[numvouts-1].scriptPubKey,name,description,format) == 'C' ) + { + if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size()) > 0 ) + { + if ( DecodeOraclesData(tx.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid ) + { + if ( (formatstr= (char *)format.c_str()) == 0 ) + formatstr = (char *)""; + result.push_back(Pair("txid",uint256_str(str,txid))); + result.push_back(Pair("data",OracleFormat((uint8_t *)data.data(),(int32_t)data.size(),formatstr,(int32_t)format.size()))); + return(result); + } + else error="invalid data tx"; + } + else error="cannot find data txid"; + } + else error="invalid oracles txid"; + } + else error="cannot find oracles txid"; + result.push_back(Pair("result","error")); + result.push_back(Pair("error",error)); + return(result); +} + UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num) { UniValue result(UniValue::VOBJ),b(UniValue::VARR); CTransaction tx,oracletx; uint256 txid,hashBlock,btxid,oracletxid; diff --git a/src/clientversion.h b/src/clientversion.h index 36f37f2e2..a02acc8bb 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -1,5 +1,6 @@ // Copyright (c) 2009-2014 The Bitcoin Core developers // Copyright (c) 2016-2017 The Zcash developers +// Copyright (c) 2019 The Hush developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -30,10 +31,11 @@ */ //! These need to be macros, as clientversion.cpp's and bitcoin*-res.rc's voodoo requires it -#define CLIENT_VERSION_MAJOR 2 +// Must be kept in sync with configure.ac ! +#define CLIENT_VERSION_MAJOR 3 #define CLIENT_VERSION_MINOR 0 -#define CLIENT_VERSION_REVISION 15 -#define CLIENT_VERSION_BUILD 26 +#define CLIENT_VERSION_REVISION 0 +#define CLIENT_VERSION_BUILD 50 //! Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true @@ -42,7 +44,7 @@ * Copyright year (2009-this) * Todo: update this when changing our copyright comments in the source */ -#define COPYRIGHT_YEAR 2018 +#define COPYRIGHT_YEAR 2019 #endif //HAVE_CONFIG_H diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 8fb86ef22..1bf8dfbeb 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1717,15 +1717,17 @@ void komodo_args(char *argv0) // I think on season change should reccomend notaries to use -notary to avoid needing this. int32_t kmd_season = getacseason(time(NULL)); for (i=0; i<64; i++) - if ( strcmp(NOTARY_PUBKEY.c_str(),notaries_elected[kmd_season][NUM_KMD_NOTARIES][1]) == 0 ) + { + if ( strcmp(NOTARY_PUBKEY.c_str(),notaries_elected[kmd_season-1][i][1]) == 0 ) { IS_KOMODO_NOTARY = 1; KOMODO_MININGTHREADS = 1; mapArgs ["-genproclimit"] = itostr(KOMODO_MININGTHREADS); IS_STAKED_NOTARY = -1; - fprintf(stderr,"running as notary.%d %s\n",i,notaries_elected[kmd_season][NUM_KMD_NOTARIES][0]); + fprintf(stderr,"running as notary.%d %s\n",i,notaries_elected[kmd_season-1][i][0]); break; } + } } } if ( IS_STAKED_NOTARY != -1 && IS_KOMODO_NOTARY == true ) { @@ -1767,7 +1769,7 @@ void komodo_args(char *argv0) { int32_t ecode = ccEnablesHeight[i]; int32_t ht = ccEnablesHeight[i+1]; - if ( ecode > 256 || ecode < 0 ) + if ( ecode > 255 || ecode < 0 ) fprintf(stderr, "ac_ccactivateht: invalid evalcode.%i must be between 0 and 256.\n", ecode); else if ( ht > 0 ) { diff --git a/src/main.cpp b/src/main.cpp index 30783e2ab..e01cba61f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -147,10 +147,28 @@ namespace { struct CBlockIndexWorkComparator { - bool operator()(CBlockIndex *pa, CBlockIndex *pb) const { + bool operator()(const CBlockIndex *pa, const CBlockIndex *pb) const { // First sort by most total work, ... - if (pa->chainPower > pb->chainPower) return false; - if (pa->chainPower < pb->chainPower) return true; + + if (ASSETCHAINS_LWMAPOS) { + + /* Decker: + + seems we had CChainPower classes compare here from Verus, it's slow, bcz of hard + arith_uint256 math in bool operator<(const CChainPower &p1, const CChainPower &p2), + this slows down setBlockIndexCandidates.insert operations in LoadBlockIndexDB(), + so, for faster block index db loading we will use check from Verus only for LWMAPOS + enabled chains. + */ + + if (pa->chainPower > pb->chainPower) return false; + if (pa->chainPower < pb->chainPower) return true; + } + else + { + if (pa->chainPower.chainWork > pb->chainPower.chainWork) return false; + if (pa->chainPower.chainWork < pb->chainPower.chainWork) return true; + } // ... then by earliest time received, ... if (pa->nSequenceId < pb->nSequenceId) return false; @@ -173,8 +191,10 @@ namespace { * as good as our current tip or better. Entries may be failed, though, and pruning nodes may be * missing the data for the block. */ + + //set> setBlockIndexCandidates; set setBlockIndexCandidates; - + /** Number of nodes with fSyncStarted. */ int nSyncStarted = 0; diff --git a/src/miner.cpp b/src/miner.cpp index 9976909fa..e4e907447 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -222,9 +222,13 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32 boost::optional cheatSpend; uint256 cbHash; - + + boost::this_thread::interruption_point(); // exit thread before entering locks. + CBlockIndex* pindexPrev = 0; { + // this should stop create block ever exiting until it has returned something. + boost::this_thread::disable_interruption(); ENTER_CRITICAL_SECTION(cs_main); ENTER_CRITICAL_SECTION(mempool.cs); pindexPrev = chainActive.LastTip(); @@ -815,7 +819,8 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32 LEAVE_CRITICAL_SECTION(cs_main); LEAVE_CRITICAL_SECTION(mempool.cs); } - throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed"); + //throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed"); // crashes the node, moved to GetBlockTemplate and issue return. + return(0); } //fprintf(stderr,"valid\n"); } diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 53a744497..4814d34dd 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -745,7 +745,8 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) #endif ENTER_CRITICAL_SECTION(cs_main); if (!pblocktemplate) - throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory or no available utxo for staking"); + throw std::runtime_error("CreateNewBlock(): create block failed"); + //throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory or no available utxo for staking"); // Need to update only after we know CreateNewBlockWithKey succeeded pindexPrev = pindexPrevNew; diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 5d7fd6d74..75360fd35 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -460,6 +460,7 @@ static const CRPCCommand vRPCCommands[] = { "oracles", "oraclesregister", &oraclesregister, true }, { "oracles", "oraclessubscribe", &oraclessubscribe, true }, { "oracles", "oraclesdata", &oraclesdata, true }, + { "oracles", "oraclessample", &oraclessample, true }, { "oracles", "oraclessamples", &oraclessamples, true }, // Prices diff --git a/src/rpc/server.h b/src/rpc/server.h index 27e7288cd..d447d2472 100644 --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -271,6 +271,7 @@ extern UniValue oraclesfund(const UniValue& params, bool fHelp); extern UniValue oraclesregister(const UniValue& params, bool fHelp); extern UniValue oraclessubscribe(const UniValue& params, bool fHelp); extern UniValue oraclesdata(const UniValue& params, bool fHelp); +extern UniValue oraclessample(const UniValue& params, bool fHelp); extern UniValue oraclessamples(const UniValue& params, bool fHelp); extern UniValue pricesaddress(const UniValue& params, bool fHelp); extern UniValue priceslist(const UniValue& params, bool fHelp); diff --git a/src/util.cpp b/src/util.cpp index efe52591d..c1fb7f72b 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1014,8 +1014,8 @@ void SetThreadPriority(int nPriority) std::string PrivacyInfo() { return "\n" + - FormatParagraph(strprintf(_("In order to ensure you are adequately protecting your privacy when using Zcash, please see <%s>."), - "https://z.cash/support/security/")) + "\n"; + FormatParagraph(strprintf(_("In order to ensure you are adequately protecting your privacy when using Hush, please see <%s>."), + "https://myhush.org/security/")) + "\n"; } std::string LicenseInfo() @@ -1024,6 +1024,7 @@ std::string LicenseInfo() FormatParagraph(strprintf(_("Copyright (C) 2009-%i The Bitcoin Core Developers"), COPYRIGHT_YEAR)) + "\n" + FormatParagraph(strprintf(_("Copyright (C) 2015-%i The Zcash Developers"), COPYRIGHT_YEAR)) + "\n" + FormatParagraph(strprintf(_("Copyright (C) 2015-%i jl777 and SuperNET developers"), COPYRIGHT_YEAR)) + "\n" + + FormatParagraph(strprintf(_("Copyright (C) 2018-%i The Hush developers"), COPYRIGHT_YEAR)) + "\n" + FormatParagraph(strprintf(_("Copyright (C) 2018-%i The Verus developers"), COPYRIGHT_YEAR)) + "\n" + "\n" + FormatParagraph(_("This is experimental software.")) + "\n" + diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 05552b50b..81ee82473 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -89,6 +89,65 @@ std::string DecodeDumpString(const std::string &str) { return ret.str(); } +UniValue convertpassphrase(const UniValue& params, bool fHelp) +{ + if (fHelp || params.size() < 1 || params.size() > 1) + throw runtime_error( + "convertpassphrase \"agamapassphrase\"\n" + "\nConverts Agama passphrase to a private key and WIF (for import with importprivkey).\n" + "\nArguments:\n" + "1. \"agamapassphrase\" (string, required) Agama passphrase\n" + "\nResult:\n" + "\"agamapassphrase\": \"agamapassphrase\", (string) Agama passphrase you entered\n" + "\"address\": \"komodoaddress\", (string) Address corresponding to your passphrase\n" + "\"pubkey\": \"publickeyhex\", (string) The hex value of the raw public key\n" + "\"privkey\": \"privatekeyhex\", (string) The hex value of the raw private key\n" + "\"wif\": \"wif\" (string) The private key in WIF format to use with 'importprivkey'\n" + "\nExamples:\n" + + HelpExampleCli("convertpassphrase", "\"agamapassphrase\"") + + HelpExampleRpc("convertpassphrase", "\"agamapassphrase\"") + ); + + bool fCompressed = true; + string strAgamaPassphrase = params[0].get_str(); + + UniValue ret(UniValue::VOBJ); + ret.push_back(Pair("agamapassphrase", strAgamaPassphrase)); + + CKey tempkey = DecodeSecret(strAgamaPassphrase); + /* first we should check if user pass wif to method, instead of passphrase */ + if (!tempkey.IsValid()) { + /* it's a passphrase, not wif */ + uint256 sha256; + CSHA256().Write((const unsigned char *)strAgamaPassphrase.c_str(), strAgamaPassphrase.length()).Finalize(sha256.begin()); + std::vector privkey(sha256.begin(), sha256.begin() + sha256.size()); + privkey.front() &= 0xf8; + privkey.back() &= 0x7f; + privkey.back() |= 0x40; + CKey key; + key.Set(privkey.begin(),privkey.end(), fCompressed); + CPubKey pubkey = key.GetPubKey(); + assert(key.VerifyPubKey(pubkey)); + CKeyID vchAddress = pubkey.GetID(); + + ret.push_back(Pair("address", EncodeDestination(vchAddress))); + ret.push_back(Pair("pubkey", HexStr(pubkey))); + ret.push_back(Pair("privkey", HexStr(privkey))); + ret.push_back(Pair("wif", EncodeSecret(key))); + } else { + /* seems it's a wif */ + CPubKey pubkey = tempkey.GetPubKey(); + assert(tempkey.VerifyPubKey(pubkey)); + CKeyID vchAddress = pubkey.GetID(); + ret.push_back(Pair("address", EncodeDestination(vchAddress))); + ret.push_back(Pair("pubkey", HexStr(pubkey))); + ret.push_back(Pair("privkey", HexStr(tempkey))); + ret.push_back(Pair("wif", strAgamaPassphrase)); + } + + return ret; +} + UniValue importprivkey(const UniValue& params, bool fHelp) { if (!EnsureWalletIsAvailable(fHelp)) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index bf861662f..ce377d094 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5564,6 +5564,8 @@ UniValue cclibinfo(const UniValue& params, bool fHelp) UniValue cclib(const UniValue& params, bool fHelp) { struct CCcontract_info *cp,C; char *method,*jsonstr=0; uint8_t evalcode = EVAL_FIRSTUSER; + std::string vobjJsonSerialized; + if ( fHelp || params.size() > 3 ) throw runtime_error("cclib method [evalcode] [JSON params]\n"); if ( ASSETCHAINS_CCLIB.size() == 0 ) @@ -5583,7 +5585,12 @@ UniValue cclib(const UniValue& params, bool fHelp) } if ( params.size() == 3 ) { - jsonstr = (char *)params[2].get_str().c_str(); + if (params[2].getType() == UniValue::VOBJ) { + vobjJsonSerialized = params[2].write(0, 0); + jsonstr = (char *)vobjJsonSerialized.c_str(); + } + else // VSTR assumed + jsonstr = (char *)params[2].get_str().c_str(); //fprintf(stderr,"params.(%s %s %s)\n",params[0].get_str().c_str(),params[1].get_str().c_str(),jsonstr); } } @@ -6830,6 +6837,20 @@ UniValue oraclessubscribe(const UniValue& params, bool fHelp) return(result); } +UniValue oraclessample(const UniValue& params, bool fHelp) +{ + UniValue result(UniValue::VOBJ); uint256 oracletxid,txid; int32_t num; char *batonaddr; + if ( fHelp || params.size() != 2 ) + throw runtime_error("oraclessample oracletxid txid\n"); + if ( ensure_CCrequirements(EVAL_ORACLES) < 0 ) + throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n"); + const CKeyStore& keystore = *pwalletMain; + LOCK2(cs_main, pwalletMain->cs_wallet); + oracletxid = Parseuint256((char *)params[0].get_str().c_str()); + txid = Parseuint256((char *)params[1].get_str().c_str()); + return(OracleDataSample(oracletxid,txid)); +} + UniValue oraclessamples(const UniValue& params, bool fHelp) { UniValue result(UniValue::VOBJ); uint256 txid; int32_t num; char *batonaddr; @@ -7956,6 +7977,7 @@ UniValue heirlist(const UniValue& params, bool fHelp) extern UniValue dumpprivkey(const UniValue& params, bool fHelp); // in rpcdump.cpp +extern UniValue convertpassphrase(const UniValue& params, bool fHelp); extern UniValue importprivkey(const UniValue& params, bool fHelp); extern UniValue importaddress(const UniValue& params, bool fHelp); extern UniValue dumpwallet(const UniValue& params, bool fHelp); @@ -7991,6 +8013,7 @@ static const CRPCCommand commands[] = { "wallet", "gettransaction", &gettransaction, false }, { "wallet", "getunconfirmedbalance", &getunconfirmedbalance, false }, { "wallet", "getwalletinfo", &getwalletinfo, false }, + { "wallet", "convertpassphrase", &convertpassphrase, true }, { "wallet", "importprivkey", &importprivkey, true }, { "wallet", "importwallet", &importwallet, true }, { "wallet", "importaddress", &importaddress, true },