Browse Source

Remove unused code

pull/1/head
practicalswift 6 years ago
parent
commit
8dc957ae06
  1. 16
      src/bitcoin-tx.cpp
  2. 3
      src/chainparams.cpp
  3. 3
      src/chainparams.h
  4. 1
      src/coins.h
  5. 4
      src/dbwrapper.h
  6. 7
      src/httpserver.cpp
  7. 5
      src/net.cpp
  8. 2
      src/net.h
  9. 1
      src/rpc/server.h
  10. 2
      src/sync.cpp
  11. 1
      src/sync.h
  12. 28
      src/test/key_tests.cpp
  13. 5
      src/test/script_tests.cpp

16
src/bitcoin-tx.cpp

@ -483,22 +483,6 @@ static bool findSighashFlags(int& flags, const std::string& flagStr) @@ -483,22 +483,6 @@ static bool findSighashFlags(int& flags, const std::string& flagStr)
return false;
}
uint256 ParseHashUO(std::map<std::string,UniValue>& o, std::string strKey)
{
if (!o.count(strKey))
return uint256();
return ParseHashUV(o[strKey], strKey);
}
std::vector<unsigned char> ParseHexUO(std::map<std::string,UniValue>& o, std::string strKey)
{
if (!o.count(strKey)) {
std::vector<unsigned char> emptyVec;
return emptyVec;
}
return ParseHexUV(o[strKey], strKey);
}
static CAmount AmountFromValue(const UniValue& value)
{
if (!value.isNum() && !value.isStr())

3
src/chainparams.cpp

@ -135,7 +135,6 @@ public: @@ -135,7 +135,6 @@ public:
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
fMiningRequiresPeers = true;
fDefaultConsistencyChecks = false;
fRequireStandard = true;
fMineBlocksOnDemand = false;
@ -235,7 +234,6 @@ public: @@ -235,7 +234,6 @@ public:
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));
fMiningRequiresPeers = true;
fDefaultConsistencyChecks = false;
fRequireStandard = false;
fMineBlocksOnDemand = false;
@ -307,7 +305,6 @@ public: @@ -307,7 +305,6 @@ public:
vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.
vSeeds.clear(); //!< Regtest mode doesn't have any DNS seeds.
fMiningRequiresPeers = false;
fDefaultConsistencyChecks = true;
fRequireStandard = false;
fMineBlocksOnDemand = true;

3
src/chainparams.h

@ -61,8 +61,6 @@ public: @@ -61,8 +61,6 @@ public:
int GetDefaultPort() const { return nDefaultPort; }
const CBlock& GenesisBlock() const { return genesis; }
/** Make miner wait to have peers to avoid wasting work */
bool MiningRequiresPeers() const { return fMiningRequiresPeers; }
/** Default value for -checkmempool and -checkblockindex argument */
bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; }
/** Policy: Filter transactions that do not match well-defined patterns */
@ -89,7 +87,6 @@ protected: @@ -89,7 +87,6 @@ protected:
std::string strNetworkID;
CBlock genesis;
std::vector<SeedSpec6> vFixedSeeds;
bool fMiningRequiresPeers;
bool fDefaultConsistencyChecks;
bool fRequireStandard;
bool fMineBlocksOnDemand;

1
src/coins.h

@ -290,7 +290,6 @@ public: @@ -290,7 +290,6 @@ public:
virtual bool GetKey(uint256 &key) const = 0;
virtual bool GetValue(CCoins &coins) const = 0;
/* Don't care about GetKeySize here */
virtual unsigned int GetValueSize() const = 0;
virtual bool Valid() const = 0;

4
src/dbwrapper.h

@ -132,10 +132,6 @@ public: @@ -132,10 +132,6 @@ public:
return true;
}
unsigned int GetKeySize() {
return piter->key().size();
}
template<typename V> bool GetValue(V& value) {
leveldb::Slice slValue = piter->value();
try {

7
src/httpserver.cpp

@ -146,13 +146,6 @@ public: @@ -146,13 +146,6 @@ public:
while (numThreads > 0)
cond.wait(lock);
}
/** Return current depth of queue */
size_t Depth()
{
std::unique_lock<std::mutex> lock(cs);
return queue.size();
}
};
struct HTTPPathHandler

5
src/net.cpp

@ -2406,11 +2406,6 @@ void CConnman::MarkAddressGood(const CAddress& addr) @@ -2406,11 +2406,6 @@ void CConnman::MarkAddressGood(const CAddress& addr)
addrman.Good(addr);
}
void CConnman::AddNewAddress(const CAddress& addr, const CAddress& addrFrom, int64_t nTimePenalty)
{
addrman.Add(addr, addrFrom, nTimePenalty);
}
void CConnman::AddNewAddresses(const std::vector<CAddress>& vAddr, const CAddress& addrFrom, int64_t nTimePenalty)
{
addrman.Add(vAddr, addrFrom, nTimePenalty);

2
src/net.h

@ -207,10 +207,8 @@ public: @@ -207,10 +207,8 @@ public:
size_t GetAddressCount() const;
void SetServices(const CService &addr, ServiceFlags nServices);
void MarkAddressGood(const CAddress& addr);
void AddNewAddress(const CAddress& addr, const CAddress& addrFrom, int64_t nTimePenalty = 0);
void AddNewAddresses(const std::vector<CAddress>& vAddr, const CAddress& addrFrom, int64_t nTimePenalty = 0);
std::vector<CAddress> GetAddresses();
void AddressCurrentlyConnected(const CService& addr);
// Denial-of-service detection/prevention
// The idea is to detect peers that are behaving

1
src/rpc/server.h

@ -28,7 +28,6 @@ namespace RPCServer @@ -28,7 +28,6 @@ namespace RPCServer
void OnStarted(boost::function<void ()> slot);
void OnStopped(boost::function<void ()> slot);
void OnPreCommand(boost::function<void (const CRPCCommand&)> slot);
void OnPostCommand(boost::function<void (const CRPCCommand&)> slot);
}
class CBlockIndex;

2
src/sync.cpp

@ -46,8 +46,6 @@ struct CLockLocation { @@ -46,8 +46,6 @@ struct CLockLocation {
return mutexName + " " + sourceFile + ":" + itostr(sourceLine) + (fTry ? " (TRY)" : "");
}
std::string MutexName() const { return mutexName; }
bool fTry;
private:
std::string mutexName;

1
src/sync.h

@ -97,7 +97,6 @@ public: @@ -97,7 +97,6 @@ public:
}
};
typedef CCriticalSection CDynamicCriticalSection;
/** Wrapped boost mutex: supports waiting but not recursive locking */
typedef AnnotatedMixin<boost::mutex> CWaitableCriticalSection;

28
src/test/key_tests.cpp

@ -29,34 +29,6 @@ static const CBitcoinAddress addr2C("1CRj2HyM1CXWzHAXLQtiGLyggNT9WQqsDs"); @@ -29,34 +29,6 @@ static const CBitcoinAddress addr2C("1CRj2HyM1CXWzHAXLQtiGLyggNT9WQqsDs");
static const std::string strAddressBad("1HV9Lc3sNHZxwj4Zk6fB38tEmBryq2cBiF");
#ifdef KEY_TESTS_DUMPINFO
void dumpKeyInfo(uint256 privkey)
{
CKey key;
key.resize(32);
memcpy(&secret[0], &privkey, 32);
std::vector<unsigned char> sec;
sec.resize(32);
memcpy(&sec[0], &secret[0], 32);
printf(" * secret (hex): %s\n", HexStr(sec).c_str());
for (int nCompressed=0; nCompressed<2; nCompressed++)
{
bool fCompressed = nCompressed == 1;
printf(" * %s:\n", fCompressed ? "compressed" : "uncompressed");
CBitcoinSecret bsecret;
bsecret.SetSecret(secret, fCompressed);
printf(" * secret (base58): %s\n", bsecret.ToString().c_str());
CKey key;
key.SetSecret(secret, fCompressed);
std::vector<unsigned char> vchPubKey = key.GetPubKey();
printf(" * pubkey (hex): %s\n", HexStr(vchPubKey).c_str());
printf(" * address (base58): %s\n", CBitcoinAddress(vchPubKey).ToString().c_str());
}
}
#endif
BOOST_FIXTURE_TEST_SUITE(key_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(key_test1)

5
src/test/script_tests.cpp

@ -455,11 +455,6 @@ public: @@ -455,11 +455,6 @@ public:
{
return comment;
}
const CScript& GetScriptPubKey()
{
return creditTx->vout[0].scriptPubKey;
}
};
std::string JSONPrettyPrint(const UniValue& univalue)

Loading…
Cancel
Save