Added functions to cache and manage yield calculations

Removed "tx.amount_locked" field - "tx.amount_burnt" is technically correct for all cases.
Removed invalid checkpoint data.
This commit is contained in:
Some Random Crypto Guy
2024-01-30 14:22:46 +00:00
parent a0d2044b5d
commit a3a7f686f3
18 changed files with 605 additions and 177 deletions
+31
View File
@@ -746,6 +746,8 @@ namespace cryptonote
*/
uint64_t get_current_cumulative_block_weight_median() const;
int get_yield_info(const uint64_t start_height, const uint64_t end_height, std::vector<std::pair<yield_tx_info, uint64_t>>& yield_container);
/**
* @brief gets the difficulty of the block with a given height
*
@@ -1145,6 +1147,33 @@ namespace cryptonote
*/
uint64_t get_adjusted_time(uint64_t height) const;
/**
* calculate the yield payouts
*
* @return TRUE if the payouts were calculated successfully, FALSE otherwise
*/
bool calculate_yield_payouts(const uint64_t start_height, std::vector<std::pair<yield_tx_info, uint64_t>>& yield_payouts);
/**
* (re)build the yield_block_info cache from the blockchain
*
* @return TRUE if the cache rebuilt correctly, FALSE otherwise
*/
bool rebuild_ybi_cache();
/**
* @brief validate the yield_block_info cache
*
* Checks that the m_yield_block_info_cache is fully populated by
* checking the size of the map, and making sure it has the most recent entry
* and the oldest expected entry as well
*
* Returns TRUE if the cache is intact, full, and up-to-date, FALSE otherwise
*
* @return TRUE if cache is OK, FALSE otherwise
*/
bool validate_ybi_cache();
#ifndef IN_UNIT_TESTS
private:
#endif
@@ -1250,6 +1279,8 @@ namespace cryptonote
// cache for verifying transaction RCT non semantics
mutable rct_ver_cache_t m_rct_ver_cache;
std::map<uint64_t, yield_block_info> m_yield_block_info_cache;
/**
* @brief collects the keys for all outputs being "spent" as an input
*