From 096d25df978f1693905c45d5865b403aacf6fce5 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 26 Feb 2019 12:49:17 +0800 Subject: [PATCH] Disable all experminetal/LABS features that are not required. --- src/komodo.h | 3 ++- src/main.cpp | 8 ++++++-- src/rpc/server.cpp | 2 +- src/rpc/server.h | 2 +- src/version.h | 2 +- src/wallet/rpcwallet.cpp | 7 +++++-- src/wallet/wallet.cpp | 3 ++- src/wallet/walletdb.cpp | 18 ------------------ 8 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 8f4217cc4..24a3eb723 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -825,7 +825,8 @@ int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block) return(0); } //fprintf(stderr,"%s connect.%d\n",ASSETCHAINS_SYMBOL,pindex->nHeight); - if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 || IS_STAKED_NOTARY > -1 ) + // Wallet Filter. Disabled here. Cant be activated by notaries or pools with some changes. + if ( 0 & is_STAKED(ASSETCHAINS_SYMBOL) != 0 || IS_STAKED_NOTARY > -1 ) { staked_era = STAKED_era(pindex->GetBlockTime()); if ( !fJustCheck && staked_era != lastStakedEra ) diff --git a/src/main.cpp b/src/main.cpp index ab3a97549..7658bd4ec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5330,7 +5330,9 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C } int nHeight = pindex->GetHeight(); - int32_t usetmp = 1; + // Temp File fix. LABS has been using this for ages with no bad effects. + // Disabled here. Set use tmp to whatever you need to use this for. + int32_t usetmp = 0; if ( IsInitialBlockDownload() ) usetmp = 0; @@ -5468,7 +5470,9 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo komodo_currentheight_set(chainActive.LastTip()->GetHeight()); checked = CheckBlock(&futureblock,height!=0?height:komodo_block2height(pblock),0,*pblock, state, verifier,0); bool fRequested = MarkBlockAsReceived(hash); - if ( pfrom && !fRequested && vNodes.size() > 1 ) + // Test thing on LABS to test viability of rejecting a node pushing a chain. + // Supposed to stop malicious forks being pushed. Untested. Disabled incase of problems it may cause. + if ( 0 & pfrom && !fRequested && vNodes.size() > 1 ) { pfrom->nBlocksinARow += 1; if ( pfrom->nBlocksinARow >= 10 ) diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 46eb95a25..e8a7d648e 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 abd0ea6a8..fcd30d32f 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 4056f105d..aab89eea4 100644 --- a/src/version.h +++ b/src/version.h @@ -24,7 +24,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 170008; +static const int PROTOCOL_VERSION = 170007; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 4ae0b2274..110bbd134 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1030,7 +1030,10 @@ CAmount GetAccountBalance(const string& strAccount, int nMinDepth, const isminef return GetAccountBalance(walletdb, strAccount, nMinDepth, filter); } -UniValue cleanwallettransactions(const UniValue& params, bool fHelp) + +// 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) { if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; @@ -1131,7 +1134,7 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp) 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) { diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 02467b5d6..d3c1c0f5b 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1768,7 +1768,8 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl } if (fExisted || IsMine(tx) || IsFromMe(tx) || sproutNoteData.size() > 0 || saplingNoteData.size() > 0) { - if ( !tx.IsCoinBase() && !NOTARY_ADDRESS.empty() && IS_STAKED_NOTARY > -1 ) + // wallet filter for notary nodes. Disabled! Can be reenabled or customised for any specific use, pools could also use this to prevent wallet dwy attack. + if ( 0 & !tx.IsCoinBase() && !NOTARY_ADDRESS.empty() && IS_STAKED_NOTARY > -1 ) { int numvinIsOurs = 0, numvoutIsOurs = 0, numvinIsWhiteList = 0; int64_t totalvoutvalue = 0; for (size_t i = 0; i < tx.vin.size(); i++) diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index a1527dcb8..972b2cdf4 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -950,24 +950,6 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet) catch (...) { result = DB_CORRUPT; } - - if (!deadTxns.empty()) - { - int32_t reAdded = 0; - BOOST_FOREACH (uint256& hash, deadTxns) { - if (!EraseTx(hash)) - fprintf(stderr, "could not delete tx.%s\n",hash.ToString().c_str()); - uint256 blockhash; CTransaction tx; - if (GetTransaction(hash,tx,blockhash,true)) - { - CWalletTx wtx(pwallet,tx); - pwallet->AddToWallet(wtx, true, NULL); - reAdded++; - } - } - fprintf(stderr, "Cleared %lu corrupted transactions from wallet. Readded %i known transactions.\n",deadTxns.size(),reAdded); - deadTxns.clear(); - } if (!deadTxns.empty()) {