diff options
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r-- | src/wallet/wallet.cpp | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 3ec6aefaec..15139c9817 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -304,20 +304,18 @@ bool CWallet::AddCryptedKey(const CPubKey &vchPubKey, } } -bool CWallet::LoadKeyMetadata(const CKeyID& keyID, const CKeyMetadata &meta) +void CWallet::LoadKeyMetadata(const CKeyID& keyID, const CKeyMetadata &meta) { AssertLockHeld(cs_wallet); // mapKeyMetadata UpdateTimeFirstKey(meta.nCreateTime); mapKeyMetadata[keyID] = meta; - return true; } -bool CWallet::LoadScriptMetadata(const CScriptID& script_id, const CKeyMetadata &meta) +void CWallet::LoadScriptMetadata(const CScriptID& script_id, const CKeyMetadata &meta) { AssertLockHeld(cs_wallet); // m_script_metadata UpdateTimeFirstKey(meta.nCreateTime); m_script_metadata[script_id] = meta; - return true; } bool CWallet::LoadCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret) @@ -470,11 +468,11 @@ void CWallet::ChainStateFlushed(const CBlockLocator& loc) batch.WriteBestBlock(loc); } -bool CWallet::SetMinVersion(enum WalletFeature nVersion, WalletBatch* batch_in, bool fExplicit) +void CWallet::SetMinVersion(enum WalletFeature nVersion, WalletBatch* batch_in, bool fExplicit) { LOCK(cs_wallet); // nWalletVersion if (nWalletVersion >= nVersion) - return true; + return; // when doing an explicit upgrade, if we pass the max version permitted, upgrade all the way if (fExplicit && nVersion > nWalletMaxVersion) @@ -492,8 +490,6 @@ bool CWallet::SetMinVersion(enum WalletFeature nVersion, WalletBatch* batch_in, if (!batch_in) delete batch; } - - return true; } bool CWallet::SetMaxVersion(int nVersion) @@ -703,9 +699,7 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase) // if we are using HD, replace the HD seed with a new one if (IsHDEnabled()) { - if (!SetHDSeed(GenerateNewSeed())) { - return false; - } + SetHDSeed(GenerateNewSeed()); } NewKeyPool(); @@ -1006,7 +1000,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose) return true; } -bool CWallet::LoadToWallet(const CWalletTx& wtxIn) +void CWallet::LoadToWallet(const CWalletTx& wtxIn) { uint256 hash = wtxIn.GetHash(); const auto& ins = mapWallet.emplace(hash, wtxIn); @@ -1025,8 +1019,6 @@ bool CWallet::LoadToWallet(const CWalletTx& wtxIn) } } } - - return true; } bool CWallet::AddToWalletIfInvolvingMe(const CTransactionRef& ptx, const CBlockIndex* pIndex, int posInBlock, bool fUpdate) @@ -1478,7 +1470,7 @@ CPubKey CWallet::DeriveNewSeed(const CKey& key) return seed; } -bool CWallet::SetHDSeed(const CPubKey& seed) +void CWallet::SetHDSeed(const CPubKey& seed) { LOCK(cs_wallet); // store the keyid (hash160) together with @@ -1488,18 +1480,15 @@ bool CWallet::SetHDSeed(const CPubKey& seed) newHdChain.nVersion = CanSupportFeature(FEATURE_HD_SPLIT) ? CHDChain::VERSION_HD_CHAIN_SPLIT : CHDChain::VERSION_HD_BASE; newHdChain.seed_id = seed.GetID(); SetHDChain(newHdChain, false); - - return true; } -bool CWallet::SetHDChain(const CHDChain& chain, bool memonly) +void CWallet::SetHDChain(const CHDChain& chain, bool memonly) { LOCK(cs_wallet); if (!memonly && !WalletBatch(*database).WriteHDChain(chain)) throw std::runtime_error(std::string(__func__) + ": writing chain failed"); hdChain = chain; - return true; } bool CWallet::IsHDEnabled() const @@ -3899,10 +3888,9 @@ bool CWallet::EraseDestData(const CTxDestination &dest, const std::string &key) return WalletBatch(*database).EraseDestData(EncodeDestination(dest), key); } -bool CWallet::LoadDestData(const CTxDestination &dest, const std::string &key, const std::string &value) +void CWallet::LoadDestData(const CTxDestination &dest, const std::string &key, const std::string &value) { mapAddressBook[dest].destdata.insert(std::make_pair(key, value)); - return true; } bool CWallet::GetDestData(const CTxDestination &dest, const std::string &key, std::string *value) const @@ -4091,9 +4079,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(const std::string& name, // generate a new master key CPubKey masterPubKey = walletInstance->GenerateNewSeed(); - if (!walletInstance->SetHDSeed(masterPubKey)) { - throw std::runtime_error(std::string(__func__) + ": Storing master key failed"); - } + walletInstance->SetHDSeed(masterPubKey); hd_upgrade = true; } // Upgrade to HD chain split if necessary @@ -4130,9 +4116,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(const std::string& name, } else { // generate a new seed CPubKey seed = walletInstance->GenerateNewSeed(); - if (!walletInstance->SetHDSeed(seed)) { - throw std::runtime_error(std::string(__func__) + ": Storing HD seed failed"); - } + walletInstance->SetHDSeed(seed); } // Top up the keypool |