aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet_errors.h
diff options
context:
space:
mode:
authorj-berman <justinberman@protonmail.com>2022-09-09 20:34:18 -0600
committerj-berman <justinberman@protonmail.com>2023-03-13 12:57:43 -0700
commit65e13dbef1c3a4cc036919203eec2052a121f034 (patch)
tree988b9a581d279b9e31ee4e19594614bdbe9faba4 /src/wallet/wallet_errors.h
parent99be9a044f3854f339548e2d99c539c18d7b1b01 (diff)
downloadmonzero-core-65e13dbef1c3a4cc036919203eec2052a121f034.tar.gz
monzero-core-65e13dbef1c3a4cc036919203eec2052a121f034.tar.xz
monzero-core-65e13dbef1c3a4cc036919203eec2052a121f034.zip
wallet2: fix rescanning tx via scan_tx
- Detach & re-process txs >= lowest scan height - ensures that if a user calls scan_tx(tx1) after scanning tx2, the wallet correctly processes tx1 and tx2 - if a user provides a tx with a height higher than the wallet's last scanned height, the wallet will scan starting from that tx's height - scan_tx requires trusted daemon iff need to re-process existing txs: in addition to querying a daemon for txids, if a user provides a txid of a tx with height *lower* than any *already* scanned txs in the wallet, then the wallet will also query the daemon for all the *higher* txs as well. This is likely unexpected behavior to a caller, and so to protect a caller from revealing txid's to an untrusted daemon in an unexpected way, require the daemon be trusted.
Diffstat (limited to 'src/wallet/wallet_errors.h')
-rw-r--r--src/wallet/wallet_errors.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/wallet/wallet_errors.h b/src/wallet/wallet_errors.h
index 0b8512163..fcf2ddd93 100644
--- a/src/wallet/wallet_errors.h
+++ b/src/wallet/wallet_errors.h
@@ -93,6 +93,8 @@ namespace tools
// get_output_distribution
// payment_required
// wallet_files_doesnt_correspond
+ // scan_tx_error *
+ // wont_reprocess_recent_txs_via_untrusted_daemon
//
// * - class with protected ctor
@@ -915,6 +917,23 @@ namespace tools
}
};
//----------------------------------------------------------------------------------------------------
+ struct scan_tx_error : public wallet_logic_error
+ {
+ protected:
+ explicit scan_tx_error(std::string&& loc, const std::string& message)
+ : wallet_logic_error(std::move(loc), message)
+ {
+ }
+ };
+ //----------------------------------------------------------------------------------------------------
+ struct wont_reprocess_recent_txs_via_untrusted_daemon : public scan_tx_error
+ {
+ explicit wont_reprocess_recent_txs_via_untrusted_daemon(std::string&& loc)
+ : scan_tx_error(std::move(loc), "The wallet has already seen 1 or more recent transactions than the scanned tx")
+ {
+ }
+ };
+ //----------------------------------------------------------------------------------------------------
#if !defined(_MSC_VER)