From 142744f22d18cddaa9378968e501706a7f3be40a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 26 Feb 2019 17:35:07 +0800 Subject: [PATCH] verushashv1_1, fix walletdb.h, proto version, cleanwallettransactions add --- src/chainparams.cpp | 2 +- src/init.cpp | 4 ++-- src/komodo_bitcoind.h | 6 +++--- src/komodo_defs.h | 2 +- src/komodo_globals.h | 2 +- src/metrics.cpp | 2 +- src/miner.cpp | 4 ++-- src/rpc/server.cpp | 2 +- src/rpc/server.h | 2 +- src/version.h | 2 +- src/wallet-utility.cpp | 2 +- src/wallet/db.h | 2 +- src/wallet/rpcwallet.cpp | 6 ++---- 13 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 5fa0007d4..6bfcc0e5c 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -297,7 +297,7 @@ void *chainparams_commandline(void *ptr) mainParams.consensus.nPowAveragingWindow = 45; mainParams.consensus.powAlternate = uint256S("00000f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f"); } - else if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV2) + else if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1) { // this is only good for 60 second blocks with an averaging window of 45. for other parameters, use: // nLwmaAjustedWeight = (N+1)/2 * (0.9989^(500/nPowAveragingWindow)) * nPowTargetSpacing diff --git a/src/init.cpp b/src/init.cpp index ea8286cd0..6049fb09f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1178,7 +1178,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) // set the hash algorithm to use for this chain // Again likely better solution here, than using long IF ELSE. - extern uint32_t ASSETCHAINS_ALGO, ASSETCHAINS_VERUSHASH, ASSETCHAINS_VERUSHASHV2; + extern uint32_t ASSETCHAINS_ALGO, ASSETCHAINS_VERUSHASH, ASSETCHAINS_VERUSHASHV1_1; CVerusHash::init(); CVerusHashV2::init(); if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH) @@ -1186,7 +1186,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) // initialize VerusHash CBlockHeader::SetVerusHash(); } - else if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV2) + else if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1) { // initialize VerusHashV2 CBlockHeader::SetVerusHashV2(); diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index f23fde7c1..dbea7ba12 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1348,7 +1348,7 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he if ( m+n < 100 ) { // We do actual PoS % at the start. Requires coin distribution in first 10 blocks! - if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH || ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV2 ) + if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH || ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1 ) percPoS = (percPoS*100) / (m+n); else // This seems to be inverse. The actual PoS % is backwards in the first 100 blocks. @@ -1453,7 +1453,7 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh if ( blocktime+iter+segid*2 < txtime+minage ) continue; diff = (iter + blocktime - txtime - minage); - if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH || ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV2 ) + if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH || ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1 ) { /*if ( PoSperc < ASSETCHAINS_STAKED ) { @@ -1481,7 +1481,7 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh if ( iter > 0 ) diff += segid*2; coinage = (value * diff); - if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH || ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV2 ) + if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH || ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1 ) { if ( PoSperc < ASSETCHAINS_STAKED ) { diff --git a/src/komodo_defs.h b/src/komodo_defs.h index 4d89fe416..2c3647b30 100644 --- a/src/komodo_defs.h +++ b/src/komodo_defs.h @@ -51,7 +51,7 @@ extern bool VERUS_MINTBLOCKS; extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_TIMELOCKGTE, ASSETCHAINS_NONCEMASK[]; extern const char *ASSETCHAINS_ALGORITHMS[]; extern int32_t VERUS_MIN_STAKEAGE; -extern uint32_t ASSETCHAINS_VERUSHASH, ASSETCHAINS_VERUSHASHV2, ASSETCHAINS_NONCESHIFT[], ASSETCHAINS_HASHESPERROUND[]; +extern uint32_t ASSETCHAINS_VERUSHASH, ASSETCHAINS_VERUSHASHV1_1, ASSETCHAINS_NONCESHIFT[], ASSETCHAINS_HASHESPERROUND[]; extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern std::string NOTARY_PUBKEY,ASSETCHAINS_OVERRIDE_PUBKEY,ASSETCHAINS_SCRIPTPUB; extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_MARMARA; diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 9c2f1df62..859fada99 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -76,7 +76,7 @@ uint8_t ASSETCHAINS_CCDISABLES[256]; uint32_t ASSETCHAINS_NUMALGOS = 3; uint32_t ASSETCHAINS_EQUIHASH = _ASSETCHAINS_EQUIHASH; uint32_t ASSETCHAINS_VERUSHASH = 1; -uint32_t ASSETCHAINS_VERUSHASHV2 = 2; +uint32_t ASSETCHAINS_VERUSHASHV1_1 = 2; const char *ASSETCHAINS_ALGORITHMS[] = {"equihash", "verushash", "verushash11"}; uint64_t ASSETCHAINS_NONCEMASK[] = {0xffff,0xfffffff,0xfffffff}; uint32_t ASSETCHAINS_NONCESHIFT[] = {32,16,16}; diff --git a/src/metrics.cpp b/src/metrics.cpp index e794ad220..1fa8ebfb5 100644 --- a/src/metrics.cpp +++ b/src/metrics.cpp @@ -136,7 +136,7 @@ int64_t GetUptime() double GetLocalSolPS() { - if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH || ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV2) + if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH || ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1) { return miningTimer.rate(nHashCount); } diff --git a/src/miner.cpp b/src/miner.cpp index 09ce3fd1a..165adb592 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -1436,7 +1436,7 @@ void static BitcoinMiner_noeq() CVerusHashV2Writer ss2 = CVerusHashV2Writer(SER_GETHASH, PROTOCOL_VERSION); ss2 << *((CBlockHeader *)pblock); - if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV2 ) + if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1 ) extraPtr = ss2.xI64p(); CVerusHashV2 &vh2 = ss2.GetState(); vh2.ClearExtra(); @@ -1459,7 +1459,7 @@ void static BitcoinMiner_noeq() *extraPtr = i; if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH ) vh.ExtraHash((unsigned char *)&hashResult); - else if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV2 ) + else if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1 ) vh2.ExtraHash((unsigned char *)&hashResult); if ( UintToArith256(hashResult) <= hashTarget ) diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index e8a7d648e..46eb95a25 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -561,7 +561,7 @@ static const CRPCCommand vRPCCommands[] = { "wallet", "getaccountaddress", &getaccountaddress, true }, { "wallet", "getaccount", &getaccount, true }, { "wallet", "getaddressesbyaccount", &getaddressesbyaccount, true }, -// { "wallet", "cleanwallettransactions", &cleanwallettransactions, false }, + { "wallet", "cleanwallettransactions", &cleanwallettransactions, false }, { "wallet", "getbalance", &getbalance, false }, { "wallet", "getbalance64", &getbalance64, false }, { "wallet", "getnewaddress", &getnewaddress, true }, diff --git a/src/rpc/server.h b/src/rpc/server.h index fcd30d32f..abd0ea6a8 100644 --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -353,7 +353,7 @@ extern UniValue signmessage(const UniValue& params, bool fHelp); extern UniValue verifymessage(const UniValue& params, bool fHelp); extern UniValue getreceivedbyaddress(const UniValue& params, bool fHelp); extern UniValue getreceivedbyaccount(const UniValue& params, bool fHelp); -//extern UniValue cleanwallettransactions(const UniValue& params, bool fHelp); +extern UniValue cleanwallettransactions(const UniValue& params, bool fHelp); extern UniValue getbalance(const UniValue& params, bool fHelp); extern UniValue getbalance64(const UniValue& params, bool fHelp); extern UniValue getunconfirmedbalance(const UniValue& params, bool fHelp); diff --git a/src/version.h b/src/version.h index aab89eea4..64150b740 100644 --- a/src/version.h +++ b/src/version.h @@ -33,7 +33,7 @@ static const int INIT_PROTO_VERSION = 209; static const int GETHEADERS_VERSION = 31800; //! disconnect from peers older than this proto version -static const int MIN_PEER_PROTO_VERSION = 170007; +static const int MIN_PEER_PROTO_VERSION = 170002; static const int STAKEDMIN_PEER_PROTO_VERSION = 170007; //! nTime field added to CAddress, starting with this version; diff --git a/src/wallet-utility.cpp b/src/wallet-utility.cpp index f4041dfbe..655a3cab4 100644 --- a/src/wallet-utility.cpp +++ b/src/wallet-utility.cpp @@ -18,7 +18,7 @@ uint32_t ASSETCHAIN_INIT,ASSETCHAINS_CC; uint32_t ASSETCHAINS_MAGIC = 2387029918; uint32_t ASSETCHAINS_EQUIHASH = 0; uint32_t ASSETCHAINS_VERUSHASH = 1; -uint32_t ASSETCHAINS_VERUSHASHV2 = 2; +uint32_t ASSETCHAINS_VERUSHASHV1_1 = 2; uint32_t ASSETCHAINS_ALGO = 0; int32_t ASSETCHAINS_LWMAPOS = 0; int32_t VERUS_BLOCK_POSUNITS = 1000; diff --git a/src/wallet/db.h b/src/wallet/db.h index f7854fe2f..19b9b6079 100644 --- a/src/wallet/db.h +++ b/src/wallet/db.h @@ -33,7 +33,7 @@ #include -#include "../depends/x86_64-unknown-linux-gnu/include/db_cxx.h" +#include extern unsigned int nWalletDBUpdated; diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 110bbd134..f49246995 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1031,9 +1031,7 @@ CAmount GetAccountBalance(const string& strAccount, int nMinDepth, const isminef } -// for cleaning wallets, many main net notaries are using this to gain a MASSIVE advantage. -// Disabled here. but they can enable it a bit easier now, then using their own forks. -/*UniValue cleanwallettransactions(const UniValue& params, bool fHelp) +UniValue cleanwallettransactions(const UniValue& params, bool fHelp) { if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; @@ -1134,7 +1132,7 @@ CAmount GetAccountBalance(const string& strAccount, int nMinDepth, const isminef ret.push_back(Pair("remaining_transactons", (int)remaining)); ret.push_back(Pair("removed_transactions", (int)(txs-remaining))); return (ret); -} */ +} UniValue getbalance(const UniValue& params, bool fHelp) {