diff --git a/src/wallet/monero_wallet.h b/src/wallet/monero_wallet.h index 90a6999..1740ce9 100644 --- a/src/wallet/monero_wallet.h +++ b/src/wallet/monero_wallet.h @@ -381,6 +381,18 @@ namespace monero { virtual uint64_t get_daemon_max_peer_height() const { throw std::runtime_error("get_daemon_max_peer_height() not supported"); } + + /** + * Get the blockchain's height by date. + * + * @param year - year of the height to get + * @param month - month of the height to get as a number between 1 and 12 + * @param day - day of the height to get as a number between 1 and 31 + * @return the blockchain's height at the given date + */ + virtual uint64_t get_height_by_date(uint16_t year, uint8_t month, uint8_t day) const { + throw std::runtime_error("get_height_by_date(year, month, day) not supported"); + } /** * Register a listener receive wallet notifications. diff --git a/src/wallet/monero_wallet_core.cpp b/src/wallet/monero_wallet_core.cpp index 5e5c714..0ff33d3 100644 --- a/src/wallet/monero_wallet_core.cpp +++ b/src/wallet/monero_wallet_core.cpp @@ -1265,6 +1265,10 @@ namespace monero { if (result == 0) result = get_daemon_height(); // TODO monero core: target height can be 0 when daemon is synced. Use blockchain height instead return result; } + + uint64_t monero_wallet_core::get_height_by_date(uint16_t year, uint8_t month, uint8_t day) const { + return m_w2->get_blockchain_height_by_date(year, month, day); + } void monero_wallet_core::add_listener(monero_wallet_listener& listener) { MTRACE("add_listener()"); diff --git a/src/wallet/monero_wallet_core.h b/src/wallet/monero_wallet_core.h index 41477ec..eb07edc 100644 --- a/src/wallet/monero_wallet_core.h +++ b/src/wallet/monero_wallet_core.h @@ -196,6 +196,7 @@ namespace monero { void set_sync_height(uint64_t sync_height) override; uint64_t get_daemon_height() const override; uint64_t get_daemon_max_peer_height() const override; + uint64_t get_height_by_date(uint16_t year, uint8_t month, uint8_t day) const override; void add_listener(monero_wallet_listener& listener) override; void remove_listener(monero_wallet_listener& listener) override; std::set get_listeners() override;