aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2022-12-01 01:06:16 -0600
committerluigi1111 <luigi1111w@gmail.com>2022-12-01 01:06:16 -0600
commitcce309512cf2293849069be9a69c5c74c3e931e4 (patch)
tree6626d53a5d5d945708c2ee39998fa2c306ba3b75 /src/wallet
parentMerge pull request #8611 (diff)
parentwallet2: fix create view-only wallet from existing wallet (diff)
downloadmonero-cce309512cf2293849069be9a69c5c74c3e931e4.tar.xz
Merge pull request #8615
85c9fe5 wallet2: fix create view-only wallet from existing wallet (j-berman)
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/api/wallet.cpp4
-rw-r--r--src/wallet/wallet2.cpp8
2 files changed, 4 insertions, 8 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index 55db4a610..085f4f9df 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -535,7 +535,7 @@ bool WalletImpl::createWatchOnly(const std::string &path, const std::string &pas
view_wallet->generate(path, password, address, viewkey);
// Export/Import outputs
- auto outputs = m_wallet->export_outputs();
+ auto outputs = m_wallet->export_outputs(true/*all*/);
view_wallet->import_outputs(outputs);
// Copy scanned blockchain
@@ -553,7 +553,7 @@ bool WalletImpl::createWatchOnly(const std::string &path, const std::string &pas
// Export/Import key images
// We already know the spent status from the outputs we exported, thus no need to check them again
- auto key_images = m_wallet->export_key_images();
+ auto key_images = m_wallet->export_key_images(true/*all*/);
uint64_t spent = 0;
uint64_t unspent = 0;
view_wallet->import_key_images(key_images.second, key_images.first, spent, unspent, false);
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 17ff0e44b..91de4fe09 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -13326,9 +13326,7 @@ size_t wallet2::import_outputs(const std::tuple<uint64_t, uint64_t, std::vector<
THROW_WALLET_EXCEPTION_IF(offset > m_transfers.size(), error::wallet_internal_error,
"Imported outputs omit more outputs that we know of");
- THROW_WALLET_EXCEPTION_IF(offset >= num_outputs, error::wallet_internal_error,
- "Offset is larger than total outputs");
- THROW_WALLET_EXCEPTION_IF(output_array.size() > num_outputs - offset, error::wallet_internal_error,
+ THROW_WALLET_EXCEPTION_IF(offset + output_array.size() > num_outputs, error::wallet_internal_error,
"Offset is larger than total outputs");
const size_t original_size = m_transfers.size();
@@ -13408,9 +13406,7 @@ size_t wallet2::import_outputs(const std::tuple<uint64_t, uint64_t, std::vector<
THROW_WALLET_EXCEPTION_IF(offset > m_transfers.size(), error::wallet_internal_error,
"Imported outputs omit more outputs that we know of. Try using export_outputs all.");
- THROW_WALLET_EXCEPTION_IF(offset >= num_outputs, error::wallet_internal_error,
- "Offset is larger than total outputs");
- THROW_WALLET_EXCEPTION_IF(output_array.size() > num_outputs - offset, error::wallet_internal_error,
+ THROW_WALLET_EXCEPTION_IF(offset + output_array.size() > num_outputs, error::wallet_internal_error,
"Offset is larger than total outputs");
const size_t original_size = m_transfers.size();