support get_height_by_date(year, month, day)

This commit is contained in:
woodser
2020-08-17 13:43:08 -04:00
parent 3d0b4c2666
commit c34c9d8429
3 changed files with 17 additions and 0 deletions
+12
View File
@@ -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.
+4
View File
@@ -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()");
+1
View File
@@ -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<monero_wallet_listener*> get_listeners() override;