diff --git a/src/wallet/monero_wallet.h b/src/wallet/monero_wallet.h index fc5d1df..6f695c5 100644 --- a/src/wallet/monero_wallet.h +++ b/src/wallet/monero_wallet.h @@ -475,6 +475,15 @@ namespace monero { throw std::runtime_error("stop_syncing() not supported"); } + /** + * Scan transactions by their hash/id. + * + * @param txHashes - tx hashes to scan + */ + virtual void scan_txs(const std::vector& tx_hashes) { + throw std::runtime_error("scan_txs() not supported"); + } + /** * Rescan the blockchain for spent outputs. * diff --git a/src/wallet/monero_wallet_full.cpp b/src/wallet/monero_wallet_full.cpp index bf680f2..2ca7a2d 100644 --- a/src/wallet/monero_wallet_full.cpp +++ b/src/wallet/monero_wallet_full.cpp @@ -1492,6 +1492,24 @@ namespace monero { m_w2->stop(); } + void monero_wallet_full::scan_txs(const std::vector& tx_ids) { + MTRACE("scan_txs()"); + if (!m_is_connected) throw std::runtime_error("Wallet is not connected to daemon"); + + // convert string ids to crypto hashes + std::vector tx_hashes; + std::vector::const_iterator i = tx_ids.begin(); + while (i != tx_ids.end()) { + cryptonote::blobdata tx_hash_blob; + if (!epee::string_tools::parse_hexstr_to_binbuff(*i++, tx_hash_blob) || tx_hash_blob.size() != sizeof(crypto::hash)) throw std::runtime_error("TX ID has invalid format"); + crypto::hash tx_hash = *reinterpret_cast(tx_hash_blob.data()); + tx_hashes.push_back(tx_hash); + } + + // scan txs + m_w2->scan_tx(tx_hashes); + } + void monero_wallet_full::rescan_spent() { MTRACE("rescan_spent()"); if (!m_is_connected) throw std::runtime_error("Wallet is not connected to daemon"); diff --git a/src/wallet/monero_wallet_full.h b/src/wallet/monero_wallet_full.h index a02e567..bb09487 100644 --- a/src/wallet/monero_wallet_full.h +++ b/src/wallet/monero_wallet_full.h @@ -206,6 +206,7 @@ namespace monero { monero_sync_result sync(uint64_t start_height, monero_wallet_listener& listener) override; void start_syncing(uint64_t sync_period_in_ms) override; void stop_syncing() override; + void scan_txs(const std::vector& tx_hashes) override; void rescan_spent() override; void rescan_blockchain() override; uint64_t get_balance() const override;