#include <validators.h>
Definition at line 139 of file validators.h.
◆ Validators()
Definition at line 169 of file validators.h.
169 : m_db(db), current_list_timestamp(0) {
170 testnet ? this->http_client.set_server(this->testnet_endpoint_addr, this->testnet_endpoint_port, boost::none) :
171 this->http_client.set_server(this->endpoint_addr, this->endpoint_port, boost::none);
172 this->testnet = testnet;
173 this->m_p2p = pprotocol;
174 };
◆ enable()
| void electroneum::basic::Validators::enable |
( |
| ) |
|
|
inline |
◆ getApplicablePublicKeys()
| vector< string > electroneum::basic::Validators::getApplicablePublicKeys |
( |
uint64_t | height, |
|
|
bool | convert_to_byte = false ) |
|
inline |
Definition at line 176 of file validators.h.
176 {
177 vector<string> keys;
178 all_of(this->list.begin(), this->list.end(), [&
height, &keys, &convert_to_byte](std::unique_ptr<Validator> &v) {
179 if (v->isWithinRange(height)) {
180 const string k = convert_to_byte ? unhex(v->getPublicKey()) : v->getPublicKey();
181 keys.push_back(k);
182 }
183 return true;
184 });
185 return keys;
186 }
◆ getSerializedValidatorList()
| string electroneum::basic::Validators::getSerializedValidatorList |
( |
| ) |
|
|
inline |
Definition at line 250 of file validators.h.
250 {
251
254 }
255
256 return this->serialized_v_list;
257 }
◆ getValidatorByKey()
| Validator electroneum::basic::Validators::getValidatorByKey |
( |
string | key | ) |
|
|
inline |
Definition at line 188 of file validators.h.
188 {
189 Validator result;
190 all_of(this->list.begin(), this->list.end(), [&
key, &result](std::unique_ptr<Validator> &v) {
191 if (v->getPublicKey() == key) {
192 result = v->getValidatorInfo();
193 }
194 return true;
195 });
196 return result;
197 }
◆ isEnabled()
| bool electroneum::basic::Validators::isEnabled |
( |
| ) |
|
|
inline |
◆ isValid()
| bool electroneum::basic::Validators::isValid |
( |
| ) |
|
|
inline |
◆ loadValidatorsList()
| bool electroneum::basic::Validators::loadValidatorsList |
( |
| ) |
|
|
inline |
Definition at line 199 of file validators.h.
199 {
200
203
204
207 LOG_PRINT_L1(
"Unable to get validator_list json from " << this->endpoint_addr <<
":" << this->endpoint_port);
208 }
209
210 this->timeout = 60*60*24;
212
214 MGINFO(
"Validators list loaded from JSON endpoint! Refresh in 12 hours");
215 return true;
216 }
217
218
220 this->timeout = 60*60*1;
221 MGINFO(
"Validators list loaded from peers! Refresh in 1 hour");
222 return true;
223 }
224
225
228 return true;
229 }
230
231
232
233 string v = m_db.get_validator_list();
234 if(!v.empty()) {
235 this->timeout = 60*60*1;
238 MGINFO(
"Validators list loaded from database! Refresh in 1 hour");
239 return true;
240 }
241 }
242
243
244 return false;
245 }
246
247 return true;
248 }
list_update_outcome setValidatorsList(const string &v_list, bool saveToDB, bool isEmergencyUpdate=false)
bool get_http_json(const boost::string_ref uri, t_response &result_struct, t_transport &transport, std::chrono::milliseconds timeout=std::chrono::seconds(15), const boost::string_ref method="GET")
◆ on_idle()
| void electroneum::basic::Validators::on_idle |
( |
| ) |
|
|
inline |
Definition at line 278 of file validators.h.
278 {
282 }
283 }
284 }
bool loadValidatorsList()
◆ setValidatorsList()
| list_update_outcome electroneum::basic::Validators::setValidatorsList |
( |
const string & | v_list, |
|
|
bool | saveToDB, |
|
|
bool | isEmergencyUpdate = false ) |
|
inline |
Definition at line 259 of file validators.h.
259 {
262
263 return validate_and_update(
res, saveToDB, isEmergencyUpdate);
264 }
bool load_t_from_json(t_struct &out, const std::string &json_buff)
The documentation for this class was generated from the following files:
- /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/cryptonote_basic/validators.h
- /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/cryptonote_basic/validators.cpp