mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-17 15:21:30 +02:00
support scan_txs() to scan txs by id
This commit is contained in:
@@ -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<std::string>& tx_hashes) {
|
||||
throw std::runtime_error("scan_txs() not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* Rescan the blockchain for spent outputs.
|
||||
*
|
||||
|
||||
@@ -1492,6 +1492,24 @@ namespace monero {
|
||||
m_w2->stop();
|
||||
}
|
||||
|
||||
void monero_wallet_full::scan_txs(const std::vector<std::string>& 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<crypto::hash> tx_hashes;
|
||||
std::vector<std::string>::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<const crypto::hash*>(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");
|
||||
|
||||
@@ -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<std::string>& tx_hashes) override;
|
||||
void rescan_spent() override;
|
||||
void rescan_blockchain() override;
|
||||
uint64_t get_balance() const override;
|
||||
|
||||
Reference in New Issue
Block a user