Witness price feed never expire?
During today's talks about expired (?) price feeds I realized that Golos might be prone to the same issue we had on Steem which caused that outdated feeds wasn't actually expired (https://github.com/steemit/steem/issues/822).
Code:
const witness_schedule_object &wso = get_witness_schedule_object();
vector <price> feeds;
feeds.reserve(wso.num_scheduled_witnesses);
for (int i = 0; i < wso.num_scheduled_witnesses; i++) {
const auto &wit = get_witness(wso.current_shuffled_witnesses[i]);
if (wit.last_sbd_exchange_update < now + STEEMIT_MAX_FEED_AGE && !wit.sbd_exchange_rate.is_null()) {
feeds.push_back(wit.sbd_exchange_rate);
}
}
As stated in the original issue:
"Once a witness published a price feed,
wit.last_sbd_exchange_update < now + STEEMIT_MAX_FEED_AGE
will always betrue
and!wit.sbd_exchange_rate.is_null()
will always betrue
, thus the price feed will never expire."
The fix should be as simple as replacing:
wit.last_sbd_exchange_update < now + STEEMIT_MAX_FEED_AGE && !wit.sbd_exchange_rate.is_null()
with
now < wit.last_sbd_exchange_update + STEEMIT_MAX_FEED_AGE && !wit.sbd_exchange_rate.is_null()
of course while keeping in mind the hardfork logic (i.e. if has_hardfork etc.)
HTH, GtG :-)
I hope that my experience from Steem can be of value on Golos.
If you think the same, please vote for me as a witness, every vote counts.
My Golos seed node, golos.rushub.ru
is up and running, listening at port 4243
.
You can contact me directly at chat.golos.io as Gandalf.