diff options
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r-- | src/wallet/wallet.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 337a5139e1..6cf9f9ce74 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -378,7 +378,7 @@ std::shared_ptr<CWallet> RestoreWallet(WalletContext& context, const fs::path& b } auto wallet_file = wallet_path / "wallet.dat"; - fs::copy_file(backup_file, wallet_file, fs::copy_option::fail_if_exists); + fs::copy_file(backup_file, wallet_file, fs::copy_options::none); auto wallet = LoadWallet(context, wallet_name, load_on_start, options, status, error, warnings); @@ -952,9 +952,7 @@ CWalletTx* CWallet::AddToWallet(CTransactionRef tx, const TxState& state, const wtx.nOrderPos = IncOrderPosNext(&batch); wtx.m_it_wtxOrdered = wtxOrdered.insert(std::make_pair(wtx.nOrderPos, &wtx)); wtx.nTimeSmart = ComputeTimeSmart(wtx, rescanning_old_block); - if (IsFromMe(*tx.get())) { - AddToSpends(hash); - } + AddToSpends(hash, &batch); } if (!fInsertedNew) @@ -1029,7 +1027,8 @@ bool CWallet::LoadToWallet(const uint256& hash, const UpdateWalletTxFn& fill_wtx if (!fill_wtx(wtx, ins.second)) { return false; } - // If wallet doesn't have a chain (e.g wallet-tool), don't bother to update txn. + // If wallet doesn't have a chain (e.g when using bitcoin-wallet tool), + // don't bother to update txn. if (HaveChain()) { bool active; auto lookup_block = [&](const uint256& hash, int& height, TxState& state) { @@ -2653,9 +2652,9 @@ std::unique_ptr<WalletDatabase> MakeWalletDatabase(const std::string& name, cons // 4. For backwards compatibility, the name of a data file in -walletdir. const fs::path wallet_path = fsbridge::AbsPathJoin(GetWalletDir(), fs::PathFromString(name)); fs::file_type path_type = fs::symlink_status(wallet_path).type(); - if (!(path_type == fs::file_not_found || path_type == fs::directory_file || - (path_type == fs::symlink_file && fs::is_directory(wallet_path)) || - (path_type == fs::regular_file && fs::PathFromString(name).filename() == fs::PathFromString(name)))) { + if (!(path_type == fs::file_type::not_found || path_type == fs::file_type::directory || + (path_type == fs::file_type::symlink && fs::is_directory(wallet_path)) || + (path_type == fs::file_type::regular && fs::PathFromString(name).filename() == fs::PathFromString(name)))) { error_string = Untranslated(strprintf( "Invalid -wallet path '%s'. -wallet path should point to a directory where wallet.dat and " "database/log.?????????? files can be stored, a location where such a directory could be created, " @@ -2694,6 +2693,10 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri error = strprintf(_("Error loading %s: Wallet requires newer version of %s"), walletFile, PACKAGE_NAME); return nullptr; } + else if (nLoadWalletRet == DBErrors::EXTERNAL_SIGNER_SUPPORT_REQUIRED) { + error = strprintf(_("Error loading %s: External signer wallet being loaded without external signer support compiled"), walletFile); + return nullptr; + } else if (nLoadWalletRet == DBErrors::NEED_REWRITE) { error = strprintf(_("Wallet needed to be rewritten: restart %s to complete"), PACKAGE_NAME); |