ZEPH support
This commit is contained in:
@@ -117,32 +117,4 @@ namespace oracle
|
|||||||
const pricing_record empty_pr = oracle::pricing_record();
|
const pricing_record empty_pr = oracle::pricing_record();
|
||||||
return (*this).equal(empty_pr);
|
return (*this).equal(empty_pr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// overload for pr validation for block
|
|
||||||
bool pricing_record::valid(cryptonote::network_type nettype, uint32_t hf_version, uint64_t bl_timestamp, uint64_t last_bl_timestamp) const
|
|
||||||
{
|
|
||||||
if (hf_version < HF_VERSION_DJED) {
|
|
||||||
if (!this->empty())
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->empty())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// validate the timestmap
|
|
||||||
if (this->timestamp > bl_timestamp + PRICING_RECORD_VALID_TIME_DIFF_FROM_BLOCK) {
|
|
||||||
LOG_ERROR("Pricing record timestamp is too far in the future.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (this->timestamp <= last_bl_timestamp - PRICING_RECORD_VALID_TIME_DIFF_FROM_BLOCK) {
|
|
||||||
LOG_ERROR("Pricing record timestamp: " << this->timestamp << ", block timestamp: " << bl_timestamp);
|
|
||||||
LOG_ERROR("Pricing record timestamp is too old.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,6 @@ namespace oracle
|
|||||||
~pricing_record() = default;
|
~pricing_record() = default;
|
||||||
bool equal(const pricing_record& other) const noexcept;
|
bool equal(const pricing_record& other) const noexcept;
|
||||||
bool empty() const noexcept;
|
bool empty() const noexcept;
|
||||||
bool valid(cryptonote::network_type nettype, uint32_t hf_version, uint64_t bl_timestamp, uint64_t last_bl_timestamp) const;
|
|
||||||
|
|
||||||
pricing_record& operator=(const pricing_record& orig) noexcept;
|
pricing_record& operator=(const pricing_record& orig) noexcept;
|
||||||
uint64_t operator[](const std::string& asset_type) const;
|
uint64_t operator[](const std::string& asset_type) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user