stakeconomy / solanamonitoring

GNU General Public License v3.0
212 stars 49 forks source link

fix vote account identity selector #7

Closed mihailShumilov closed 3 years ago

mihailShumilov commented 3 years ago

In case when someone, like me, has changed his vote account current selected returned two vote account ids that produced an error

/home/solana/solanamonitoring/monitor.sh: line 42: [: 8dY5bV5Ur1Yf9Z21ETZBRNQCMFtTr8ZdByeTo8tNAxFW: binary operator expected
error: Found argument 'AD94FjYKbBs6e2yUPrmK79NWSLo5JsihiuFuvh8uj6jh' which wasn't expected, or isn't valid in this context

To prevent that I have changed query to get first vote account id

stakeconomy commented 3 years ago

Thanks @mihailShumilov appriciated

bji commented 3 years ago

How do you know that the first entry returned is the one you want to use? What if the delinquent entry comes first and the non-delinquent one comes second? Does the API that you are using guarantee an order?

I don't think it does, and if it doesn't, then perhaps it would be better to look at both entries and compare fields whose values can be used to identify which entry to use. For example maybe the one with the highest most recent vote?