Browse Source

Remove unreachable or otherwise redundant code

0.15
practicalswift 8 years ago
parent
commit
4265bf351a
  1. 1
      src/bitcoin-tx.cpp
  2. 2
      src/qt/test/rpcnestedtests.cpp
  3. 1
      src/wallet/crypter.cpp
  4. 1
      src/wallet/rpcwallet.cpp
  5. 3
      src/wallet/wallet.cpp
  6. 10
      src/wallet/walletdb.cpp

1
src/bitcoin-tx.cpp

@ -299,7 +299,6 @@ static void MutateTxAddOutPubKey(CMutableTransaction& tx, const std::string& str
if (!pubkey.IsFullyValid()) if (!pubkey.IsFullyValid())
throw std::runtime_error("invalid TX output pubkey"); throw std::runtime_error("invalid TX output pubkey");
CScript scriptPubKey = GetScriptForRawPubKey(pubkey); CScript scriptPubKey = GetScriptForRawPubKey(pubkey);
CBitcoinAddress addr(scriptPubKey);
// Extract and validate FLAGS // Extract and validate FLAGS
bool bSegWit = false; bool bSegWit = false;

2
src/qt/test/rpcnestedtests.cpp

@ -33,8 +33,6 @@ static const CRPCCommand vRPCCommands[] =
void RPCNestedTests::rpcNestedTests() void RPCNestedTests::rpcNestedTests()
{ {
UniValue jsonRPCError;
// do some test setup // do some test setup
// could be moved to a more generic place when we add more tests on QT level // could be moved to a more generic place when we add more tests on QT level
const CChainParams& chainparams = Params(); const CChainParams& chainparams = Params();

1
src/wallet/crypter.cpp

@ -274,7 +274,6 @@ bool CCryptoKeyStore::GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) co
// Check for watch-only pubkeys // Check for watch-only pubkeys
return CBasicKeyStore::GetPubKey(address, vchPubKeyOut); return CBasicKeyStore::GetPubKey(address, vchPubKeyOut);
} }
return false;
} }
bool CCryptoKeyStore::EncryptKeys(CKeyingMaterial& vMasterKeyIn) bool CCryptoKeyStore::EncryptKeys(CKeyingMaterial& vMasterKeyIn)

1
src/wallet/rpcwallet.cpp

@ -1064,7 +1064,6 @@ public:
bool operator()(const CNoDestination &dest) const { return false; } bool operator()(const CNoDestination &dest) const { return false; }
bool operator()(const CKeyID &keyID) { bool operator()(const CKeyID &keyID) {
CPubKey pubkey;
if (pwallet) { if (pwallet) {
CScript basescript = GetScriptForDestination(keyID); CScript basescript = GetScriptForDestination(keyID);
isminetype typ; isminetype typ;

3
src/wallet/wallet.cpp

@ -205,7 +205,6 @@ bool CWallet::AddCryptedKey(const CPubKey &vchPubKey,
vchCryptedSecret, vchCryptedSecret,
mapKeyMetadata[vchPubKey.GetID()]); mapKeyMetadata[vchPubKey.GetID()]);
} }
return false;
} }
bool CWallet::LoadKeyMetadata(const CTxDestination& keyID, const CKeyMetadata &meta) bool CWallet::LoadKeyMetadata(const CTxDestination& keyID, const CKeyMetadata &meta)
@ -2708,8 +2707,6 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT
unsigned int nBytes = GetVirtualTransactionSize(txNew); unsigned int nBytes = GetVirtualTransactionSize(txNew);
CTransaction txNewConst(txNew);
// Remove scriptSigs to eliminate the fee calculation dummy signatures // Remove scriptSigs to eliminate the fee calculation dummy signatures
for (auto& vin : txNew.vin) { for (auto& vin : txNew.vin) {
vin.scriptSig = CScript(); vin.scriptSig = CScript();

10
src/wallet/walletdb.cpp

@ -76,8 +76,6 @@ bool CWalletDB::WriteCryptedKey(const CPubKey& vchPubKey,
const std::vector<unsigned char>& vchCryptedSecret, const std::vector<unsigned char>& vchCryptedSecret,
const CKeyMetadata &keyMeta) const CKeyMetadata &keyMeta)
{ {
const bool fEraseUnencryptedKey = true;
if (!WriteIC(std::make_pair(std::string("keymeta"), vchPubKey), keyMeta)) { if (!WriteIC(std::make_pair(std::string("keymeta"), vchPubKey), keyMeta)) {
return false; return false;
} }
@ -85,12 +83,8 @@ bool CWalletDB::WriteCryptedKey(const CPubKey& vchPubKey,
if (!WriteIC(std::make_pair(std::string("ckey"), vchPubKey), vchCryptedSecret, false)) { if (!WriteIC(std::make_pair(std::string("ckey"), vchPubKey), vchCryptedSecret, false)) {
return false; return false;
} }
if (fEraseUnencryptedKey) EraseIC(std::make_pair(std::string("key"), vchPubKey));
{ EraseIC(std::make_pair(std::string("wkey"), vchPubKey));
EraseIC(std::make_pair(std::string("key"), vchPubKey));
EraseIC(std::make_pair(std::string("wkey"), vchPubKey));
}
return true; return true;
} }

Loading…
Cancel
Save