trb

trb
Log | Files | Refs

commit 4a8b42242c25cabdcf70e9be0a5b278e5ca1769c
parent 270ca19d951c21bb17c0c904f56011b53b1b5b78
Author: Shinoa-Fores <btcinfo@sdf.org>
Date:   Wed, 13 Jan 2021 17:26:46 -0500

asciilifeform_lets_lose_testnet.vpatch

Diffstat:
Mbitcoin/src/base58.h | 11+++--------
Mbitcoin/src/bitcoinrpc.cpp | 1-
Mbitcoin/src/checkpoints.cpp | 6------
Mbitcoin/src/init.cpp | 4+---
Mbitcoin/src/main.cpp | 46+++-------------------------------------------
Mbitcoin/src/protocol.h | 5++---
Mbitcoin/src/util.cpp | 9---------
Mbitcoin/src/util.h | 1-
8 files changed, 9 insertions(+), 74 deletions(-)

diff --git a/bitcoin/src/base58.h b/bitcoin/src/base58.h @@ -252,14 +252,14 @@ public: }; // base58-encoded bitcoin addresses -// Addresses have version 0 or 111 (testnet) +// Addresses have version 0 // The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the serialized public key class CBitcoinAddress : public CBase58Data { public: bool SetHash160(const uint160& hash160) { - SetData(fTestNet ? 111 : 0, &hash160, 20); + SetData(0, &hash160, 20); return true; } @@ -271,20 +271,15 @@ public: bool IsValid() const { int nExpectedSize = 20; - bool fExpectTestNet = false; switch(nVersion) { case 0: break; - case 111: - fExpectTestNet = true; - break; - default: return false; } - return fExpectTestNet == fTestNet && vchData.size() == nExpectedSize; + return vchData.size() == nExpectedSize; } CBitcoinAddress() diff --git a/bitcoin/src/bitcoinrpc.cpp b/bitcoin/src/bitcoinrpc.cpp @@ -303,7 +303,6 @@ Value getinfo(const Array& params, bool fHelp) obj.push_back(Pair("genproclimit", (int)(fLimitProcessors ? nLimitProcessors : -1))); obj.push_back(Pair("difficulty", (double)GetDifficulty())); obj.push_back(Pair("hashespersec", gethashespersec(params, false))); - obj.push_back(Pair("testnet", fTestNet)); obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime())); obj.push_back(Pair("keypoolsize", pwalletMain->GetKeyPoolSize())); obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee))); diff --git a/bitcoin/src/checkpoints.cpp b/bitcoin/src/checkpoints.cpp @@ -35,8 +35,6 @@ namespace Checkpoints bool CheckBlock(int nHeight, const uint256& hash) { - if (fTestNet) return true; // Testnet has no checkpoints - MapCheckpoints::const_iterator i = mapCheckpoints.find(nHeight); if (i == mapCheckpoints.end()) return true; return hash == i->second; @@ -44,15 +42,11 @@ namespace Checkpoints int GetTotalBlocksEstimate() { - if (fTestNet) return 0; - return mapCheckpoints.rbegin()->first; } CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex) { - if (fTestNet) return NULL; - BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, mapCheckpoints) { const uint256& hash = i.second; diff --git a/bitcoin/src/init.cpp b/bitcoin/src/init.cpp @@ -160,7 +160,7 @@ bool AppInit2(int argc, char* argv[]) " -datadir=<dir> \t\t " + _("Specify data directory\n") + " -timeout=<n> \t " + _("Specify connection timeout (in milliseconds)\n") + " -proxy=<ip:port> \t " + _("Connect through socks4 proxy\n") + - " -port=<port> \t\t " + _("Listen for connections on <port> (default: 8333 or testnet: 18333)\n") + + " -port=<port> \t\t " + _("Listen for connections on <port> (default: 8333)\n") + " -maxconnections=<n>\t " + _("Maintain at most <n> connections to peers (default: 125)\n") + " -myip=<ip> \t " + _("Set this node's external IP address.\n") + " -addnode=<ip> \t " + _("Add a node to connect to\n") + @@ -172,7 +172,6 @@ bool AppInit2(int argc, char* argv[]) " -maxsendbuffer=<n>\t " + _("Maximum per-connection send buffer, <n>*1000 bytes (default: 10000)\n") + " -paytxfee=<amt> \t " + _("Fee per kB to add to transactions you send\n") + " -daemon \t\t " + _("Run in the background as a daemon and accept commands\n") + - " -testnet \t\t " + _("Use the test network\n") + " -debug \t\t " + _("Output extra debugging information\n") + " -caneat \t\t " + _("Permit the use of 'eatblock'\n") + " -logtimestamps \t " + _("Prepend debug output with timestamp\n") + @@ -194,7 +193,6 @@ bool AppInit2(int argc, char* argv[]) return false; } - fTestNet = GetBoolArg("-testnet"); fDebug = GetBoolArg("-debug"); fDaemon = GetBoolArg("-daemon"); fCanEat = GetBoolArg("-caneat"); diff --git a/bitcoin/src/main.cpp b/bitcoin/src/main.cpp @@ -311,8 +311,8 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi if (GetSigOpCount() > nSize / 34 || nSize < 100) return error("AcceptToMemoryPool() : transaction with out-of-bounds SigOpCount"); - // Rather not work on nonstandard transactions (unless -testnet) - if (!fTestNet && !IsStandard()) + // Rather not work on nonstandard transactions + if (!IsStandard()) return error("AcceptToMemoryPool() : nonstandard transaction type"); // Do we already have it? @@ -600,11 +600,6 @@ static const int64 nInterval = nTargetTimespan / nTargetSpacing; // unsigned int ComputeMinWork(unsigned int nBase, int64 nTime) { - // Testnet has min-difficulty blocks - // after nTargetSpacing*2 time between blocks: - if (fTestNet && nTime > nTargetSpacing*2) - return bnProofOfWorkLimit.GetCompact(); - CBigNum bnResult; bnResult.SetCompact(nBase); while (nTime > 0 && bnResult < bnProofOfWorkLimit) @@ -630,23 +625,6 @@ unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBl // Only change once per interval if ((pindexLast->nHeight+1) % nInterval != 0) { - // Special rules for testnet after 15 Feb 2012: - if (fTestNet && pblock->nTime > 1329264000) - { - // If the new block's timestamp is more than 2* 10 minutes - // then allow mining of a min-difficulty block. - if (pblock->nTime - pindexLast->nTime > nTargetSpacing*2) - return nProofOfWorkLimit; - else - { - // Return the last non-special-min-difficulty-rules-block - const CBlockIndex* pindex = pindexLast; - while (pindex->pprev && pindex->nHeight % nInterval != 0 && pindex->nBits == nProofOfWorkLimit) - pindex = pindex->pprev; - return pindex->nBits; - } - } - return pindexLast->nBits; } @@ -992,8 +970,7 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex) // This logic is not necessary for memory pool transactions, as AcceptToMemoryPool // already refuses previously-known transaction id's entirely. // This rule applies to all blocks whose timestamp is after March 15, 2012, 0:00 UTC. - // On testnet it is enabled as of februari 20, 2012, 0:00 UTC. - if (pindex->nTime > 1331769600 || (fTestNet && pindex->nTime > 1329696000)) + if (pindex->nTime > 1331769600) BOOST_FOREACH(CTransaction& tx, vtx) { CTxIndex txindexOld; @@ -1461,16 +1438,6 @@ FILE* AppendBlockFile(unsigned int& nFileRet) bool LoadBlockIndex(bool fAllowNew) { - if (fTestNet) - { - hashGenesisBlock = uint256("0x00000007199508e34a9ff81e6ec0c477a4cccff2a4767a8eee39c11db367b008"); - bnProofOfWorkLimit = CBigNum(~uint256(0) >> 28); - pchMessageStart[0] = 0xfa; - pchMessageStart[1] = 0xbf; - pchMessageStart[2] = 0xb5; - pchMessageStart[3] = 0xda; - } - // // Load block index // @@ -1511,13 +1478,6 @@ bool LoadBlockIndex(bool fAllowNew) block.nBits = 0x1d00ffff; block.nNonce = 2083236893; - if (fTestNet) - { - block.nTime = 1296688602; - block.nBits = 0x1d07fff8; - block.nNonce = 384568319; - } - //// debug print printf("%s\n", block.GetHash().ToString().c_str()); printf("%s\n", hashGenesisBlock.ToString().c_str()); diff --git a/bitcoin/src/protocol.h b/bitcoin/src/protocol.h @@ -14,10 +14,9 @@ #include <string> #include "uint256.h" -extern bool fTestNet; -static inline unsigned short GetDefaultPort(const bool testnet = fTestNet) +static inline unsigned short GetDefaultPort() { - return testnet ? 18333 : 8333; + return 8333; } // diff --git a/bitcoin/src/util.cpp b/bitcoin/src/util.cpp @@ -28,7 +28,6 @@ bool fDaemon = false; bool fServer = false; bool fCommandLine = false; string strMiscWarning; -bool fTestNet = false; bool fNoListen = false; bool fLogTimestamps = false; @@ -685,14 +684,6 @@ void GetDataDir(char* pszDir) strlcpy(pszDir, pszCachedDir, MAX_PATH); nVariation = 1; } - if (fTestNet) - { - char* p = pszDir + strlen(pszDir); - if (p > pszDir && p[-1] != '/' && p[-1] != '\\') - *p++ = '/'; - strcpy(p, "testnet"); - nVariation += 2; - } static bool pfMkdir[4]; if (!pfMkdir[nVariation]) { diff --git a/bitcoin/src/util.h b/bitcoin/src/util.h @@ -118,7 +118,6 @@ extern bool fDaemon; extern bool fServer; extern bool fCommandLine; extern std::string strMiscWarning; -extern bool fTestNet; extern bool fNoListen; extern bool fLogTimestamps;