mirror of
https://github.com/monero-project/monero.git
synced 2025-08-15 21:10:19 -04:00
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.
This commit is contained in:
parent
99be9a044f
commit
65e13dbef1
12 changed files with 631 additions and 69 deletions
|
@ -3215,7 +3215,6 @@ bool simple_wallet::scan_tx(const std::vector<std::string> &args)
|
|||
}
|
||||
txids.insert(txid);
|
||||
}
|
||||
std::vector<crypto::hash> txids_v(txids.begin(), txids.end());
|
||||
|
||||
if (!m_wallet->is_trusted_daemon()) {
|
||||
message_writer(console_color_red, true) << tr("WARNING: this operation may reveal the txids to the remote node and affect your privacy");
|
||||
|
@ -3228,7 +3227,9 @@ bool simple_wallet::scan_tx(const std::vector<std::string> &args)
|
|||
LOCK_IDLE_SCOPE();
|
||||
m_in_manual_refresh.store(true);
|
||||
try {
|
||||
m_wallet->scan_tx(txids_v);
|
||||
m_wallet->scan_tx(txids);
|
||||
} catch (const tools::error::wont_reprocess_recent_txs_via_untrusted_daemon &e) {
|
||||
fail_msg_writer() << e.what() << ". Either connect to a trusted daemon by passing --trusted-daemon when starting the wallet, or use rescan_bc to rescan the chain.";
|
||||
} catch (const std::exception &e) {
|
||||
fail_msg_writer() << e.what();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue