Sort:  

It says so here:
https://gitlab.syncad.com/hive/hive/-/blob/master/doc/witness_parameters.md#L9

However, here's the median price feed:
https://gitlab.syncad.com/hive/hive/-/blob/master/libraries/chain/database.cpp#L4310

  for( int i = 0; i < wso.num_scheduled_witnesses; i++ )
  {

At first glance, that actually looks like it could be 21, not 20...
I looked into where that num_scheduled_witnesses comes from, but that also looks like it should be 20:
https://gitlab.syncad.com/hive/hive/-/blob/master/libraries/chain/include/hive/chain/witness_objects.hpp#L171

Anyways,

I have pointed you to the code.
...it always said in the official repos that only the top 20's price feed gets used.
I can't see where that happens, though. I trust it still does and I am not reading the function right.

Ok, first thank you so much for going look into the code. That means a lot to me.

Let me try to clear the confusion here. And I will amend my comment so it becomes more clear why it matters (I wanted to be a bit harsh but I guess I need to be more correct and less influential) the higher you are as a backup witness. But you can do your own research and find out more if you wish.

HIVE has so-called "rounds" of scheduled witnesses (20 top + 1 backup). During this round, the scheduled witnesses will produce blocks, one by one, 3 seconds apart. Then, when the round is over a new round is elected/shuffled. In this next round a new backup witness is selected (there is a ranked weighted rotation schedule that can change on every round) and then during that round the new 21 witnesses (20 top + 1 next_backup) another 21 blocks will be produced, and so on.

The price feed median is calculated on every block produced from all the scheduled witnesses in that round. Meaning that every time there is a backup witness on that 21 witnesses round, the price feed advertised by that backup witness will be used for the calculation. Hence, backup witnesses should have a correct price feed.

I agree on the part that it's not the end of the world and this is why we have 20 top witnesses to have a higher weight on this median price. But I still like to think it matters because I am, after all, participating on a schedule eventually. So, that was the reason for me to be so harsh on my comment that I will now amend...

Here is a very cool tool done by @arcange where you can check this in movement... He shared it on this post: https://peakd.com/witness-category/@arcange/witness-schedule-testnet

As you can see you already produced a block and your feed was used when your witness was in the scheduled witness round where your witness produced the block.

As always, discussing and asking stuff makes us learn a lot every day. I am happy to fix/change things if I find I am wrong... no harm in that. And people should be aware that they either do their own research or they can be lured on mistakes/opinions that might not necessarily reflect their own.

Cheers (and don't be so harsh on yourself... that misinformation part was a bit too hard but ok. I was just putting up my opinion... of what I think matters for witnesses under the big top... I don't even want to go that higher because I don't feel I am giving out enough to be that high... and also because my node is mostly for my own usage as you can check in this post).

  1. How did your English change from lazy + broken to this?
  2. It was always communitcated to me that only the top 20 counts.
    I will make a gitlab issue from it, because I want this to be fixed.

I have been discussing this for years and there are more parts in the documentation, where it says 20 prices get pushed every round.

Link me please.

The price feed median is calculated on every block produced from all the scheduled witnesses in that round. Meaning that every time there is a backup witness on that 21 witnesses round, the price feed advertised by that backup witness will be used for the calculation. Hence, backup witnesses should have a correct price feed.

This is not correct. Price feed median is calculated every round, not every block.

Then, as the computed value is a median and not an average, the fact that a backup witness with an inaccurate price feed comes into play does not really matter as long as there is no big split between values reported by the top 20 witnesses.

There is therefore technically no reason to require a witness to update his price feed and a witness is free to report the price he wants. When it comes to who votes for him and who should or should not approve such behavior, that's another debate.

Humm The way I read the code, I understood that for every block pushed it would also re-calculate the median. Need to check again the database source.

It would be useless to do it at each block as the underlying values do not change.

Yeah… they don’t even change per rounds sometimes.. but I was just analysing the code. Seeing the possibilities of hacking.

And thinking from a perspective of “if someone wants” to mess up with prices, would it be possible. But I guess that having the top 20 right with the median is 99% right… if they keep it right.

And yeah… it eventually all comes down to voting… my hole point from the post.

Thanks both, you and @felixxx for forcing me 😁 to check more.

Done, post updated. By the way, I have added an example of how easy is to setup a price feed... but there are a couple of examples you can already find via ecency search bar for example:
https://peakd.com/witness/@rishi556/how-to-setup-hive-witness-pricefeed-using-hivefeed-js