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.
And... it is fixed in 14 hours. Congratulations :-)
Great! Waiting for hardfork to see it alive;))
BTW, why did you change:
?
There are still
fc:days(7)
usages later:That's not me.
From the blockchain perspective it's actually earlier (i.e. pre HF16) not later ;-)
@gtg Поздравляю! Вы получили личную награду!
С Днём Рождения - 1 год на Голосе
Вы можете нажать на бейдж, чтобы увидеть свою страницу на Доске Почета.
Ваш пост поддержали следующие Инвесторы Сообщества "Добрый кит":
t3ran13, max-max, vik, tristamoff, semasping, voltash, boltyn, vika-teplo, novy, dart-ezra, verdon
Поэтому я тоже проголосовал за него!
Узнать подробности о сообществе можно тут:
Разрешите представиться - Кит Добрый
Правила
Инструкция по внесению Инвестиционного взноса
Вы тоже можете стать Инвестором и поддержать проект!!!
Если Вы хотите отказаться от поддержки Доброго Кита, то ответьте на этот комментарий командой "!нехочу"
dobryj.kit теперь стал Делегатом! Ваш голос важен для всего сообщества!!!
Поддержите нас на странице https://golos.io/~witnesses, вот так:
They should use tests to fix such bugs just after wrote;)))
Also, due to nature of this platform, there are no "they", it is us.
Theoretically yes;)
In practice we have "core team", working on core and getting $$ for it. And I know nobody who will add such big feature as tests for free;) With probability that Pull Request will be rejected))
Writing tests to cover all operation for such complex platform is not an easy taks to do. Biggest corporation are struggling with it too.
Yeah, adding tests to existing large project is much harder then write them with codе))