diff --git a/src/coins.h b/src/coins.h index 785019410b536..bb37fe31ace0d 100644 --- a/src/coins.h +++ b/src/coins.h @@ -185,7 +185,6 @@ class CCoinsViewCursor virtual bool GetKey(COutPoint& key) const = 0; virtual bool GetValue(Coin& coin) const = 0; - /* Don't care about GetKeySize here */ virtual unsigned int GetValueSize() const = 0; virtual bool Valid() const = 0; diff --git a/src/dbwrapper.h b/src/dbwrapper.h index 033762b8201cd..30a561df67a65 100644 --- a/src/dbwrapper.h +++ b/src/dbwrapper.h @@ -173,11 +173,6 @@ class CDBIterator return CDataStream(slKey.data(), slKey.data() + slKey.size(), SER_DISK, CLIENT_VERSION); } - unsigned int GetKeySize() - { - return piter->key().size(); - } - template bool GetValue(V& value) { leveldb::Slice slValue = piter->value(); @@ -487,18 +482,6 @@ class CDBTransactionIterator } } - unsigned int GetKeySize() - { - if (!Valid()) { - return 0; - } - if (curIsParent) { - return parentIt->GetKeySize(); - } else { - return transactionIt->first.vKey.size(); - } - } - template bool GetValue(V& value) { diff --git a/src/httpserver.cpp b/src/httpserver.cpp index de716e97691ba..65418238a6844 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -125,13 +125,6 @@ class WorkQueue running = false; cond.notify_all(); } - - /** Return current depth of queue */ - size_t Depth() - { - std::unique_lock lock(cs); - return queue.size(); - } }; struct HTTPPathHandler diff --git a/src/key.cpp b/src/key.cpp index 7dd4b9b1b7f4f..afd533c9667dd 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -164,21 +164,10 @@ void CKey::MakeNewKey(bool fCompressedIn) fCompressed = fCompressedIn; } -bool CKey::SetPrivKey(const CPrivKey& privkey, bool fCompressedIn) -{ - if (!ec_privkey_import_der(secp256k1_context_sign, (unsigned char*)begin(), &privkey[0], privkey.size())) - return false; - fCompressed = fCompressedIn; - fValid = true; - return true; -} - uint256 CKey::GetPrivKey_256() { void* key = keydata.data(); - uint256* key_256 = (uint256*)key; - - return *key_256; + return *(uint256*)key; } CPrivKey CKey::GetPrivKey() const @@ -198,8 +187,8 @@ CPubKey CKey::GetPubKey() const { assert(fValid); secp256k1_pubkey pubkey; + size_t clen = CPubKey::PUBLIC_KEY_SIZE; CPubKey result; - size_t clen = 65; int ret = secp256k1_ec_pubkey_create(secp256k1_context_sign, &pubkey, begin()); assert(ret); secp256k1_ec_pubkey_serialize(secp256k1_context_sign, (unsigned char*)result.begin(), &clen, &pubkey, fCompressed ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED); @@ -289,13 +278,13 @@ bool CKey::Derive(CKey& keyChild, ChainCode &ccChild, unsigned int nChild, const return ret; } -bool CExtKey::Derive(CExtKey& out, unsigned int nChild) const +bool CExtKey::Derive(CExtKey& out, unsigned int _nChild) const { out.nDepth = nDepth + 1; CKeyID id = key.GetPubKey().GetID(); memcpy(&out.vchFingerprint[0], &id, 4); - out.nChild = nChild; - return key.Derive(out.key, out.chaincode, nChild, chaincode); + out.nChild = _nChild; + return key.Derive(out.key, out.chaincode, _nChild, chaincode); } void CExtKey::SetSeed(const unsigned char* seed, unsigned int nSeedLen) diff --git a/src/key.h b/src/key.h index 9ee98a159704e..8f54d3111e351 100644 --- a/src/key.h +++ b/src/key.h @@ -97,9 +97,6 @@ class CKey //! Check whether the public key corresponding to this private key is (to be) compressed. bool IsCompressed() const { return fCompressed; } - //! Initialize from a CPrivKey (serialized secp256k1 private key data). - bool SetPrivKey(const CPrivKey& vchPrivKey, bool fCompressed); - //! Generate a new private key using a cryptographic PRNG. void MakeNewKey(bool fCompressed); diff --git a/src/pivx-tx.cpp b/src/pivx-tx.cpp index ff4b25bb3c5bb..54e80b2f37628 100644 --- a/src/pivx-tx.cpp +++ b/src/pivx-tx.cpp @@ -412,13 +412,6 @@ static bool findSighashFlags(int& flags, const std::string& flagStr) return false; } -uint256 ParseHashUO(std::map& o, std::string strKey) -{ - if (!o.count(strKey)) - return UINT256_ZERO; - return ParseHashUV(o[strKey], strKey); -} - static inline int64_t roundint64(double d) { return (int64_t)(d > 0 ? d + 0.5 : d - 0.5); @@ -437,15 +430,6 @@ static CAmount AmountFromValue(const UniValue& value) return nAmount; } -std::vector ParseHexUO(std::map& o, std::string strKey) -{ - if (!o.count(strKey)) { - std::vector emptyVec; - return emptyVec; - } - return ParseHexUV(o[strKey], strKey); -} - static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr) { int nHashType = SIGHASH_ALL; diff --git a/src/rpc/server.h b/src/rpc/server.h index 1353635dabd21..c026f9df45b18 100644 --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -25,7 +25,6 @@ namespace RPCServer void OnStarted(std::function slot); void OnStopped(std::function slot); void OnPreCommand(std::function slot); - void OnPostCommand(std::function slot); } class CBlockIndex; diff --git a/src/test/key_tests.cpp b/src/test/key_tests.cpp index a7c8c3739ed84..6ca8d4e6cda43 100644 --- a/src/test/key_tests.cpp +++ b/src/test/key_tests.cpp @@ -31,29 +31,6 @@ static const std::string addr2C = "DNBVSAoc2whPFjZVAZ1pQbXPJk1LRrDC8Q"; static const std::string strAddressBad ="Xta1praZQjyELweyMByXyiREw1ZRsjXzVP"; -#ifdef KEY_TESTS_DUMPINFO -void dumpKeyInfo(uint256 privkey) -{ - CKey key; - key.resize(32); - memcpy(&secret[0], &privkey, 32); - std::vector 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++) - { - printf(" * secret (base58): %s\n", KeyIO::EncodeSecret(secret)); - CKey key; - key.SetSecret(secret, fCompressed); - std::vector vchPubKey = key.GetPubKey(); - printf(" * pubkey (hex): %s\n", HexStr(vchPubKey).c_str()); - printf(" * address (base58): %s\n", EncodeDestination(vchPubKey).c_str()); - } -} -#endif - BOOST_FIXTURE_TEST_SUITE(key_tests, TestingSetup) BOOST_AUTO_TEST_CASE(key_test1) diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp index 31a3ac7ee15c5..895ef6e7e12ec 100644 --- a/src/test/script_tests.cpp +++ b/src/test/script_tests.cpp @@ -370,11 +370,6 @@ class TestBuilder { return comment; } - - const CScript& GetScriptPubKey() - { - return creditTx->vout[0].scriptPubKey; - } }; std::string JSONPrettyPrint(const UniValue& univalue)