I am building a Cron job to check leader-slots and during testing/learning phase I saw that the command will not start if the slot isn't greater than first slot of the epoch + stability window slots amount or 1.5 days.
Reading around the web I found out that stability window could be edited by the protocol in some cases (please correct me if I am wrong), and so my question is:
Is there a way to query the first block of the epoch and the current stability window? This way I can check those parameters first and then run leadership-schedule command. Or can you advise other ways to run the leadership-schedule command with a cronjob and being sure that it will run?
Thanks for your time. Have a great day.
EDIT: what I am currently doing is reading gLiveView code and understanding it.
I found out that there is a function called getEpochStart and I could use it with epoch % of completion to find out when run the job, this way I wouldn't need the Stability window slot amount.
From what I understood, the math that I would need to do is:
timestamp = byron_genesis_start_sec(1563999616) + ((epoch_no(197) * BYRON_EPOCH_LENGTH(21600) * BYRON_SLOT_LENGTH(20000)) / 1000)
By doing the math, I got that epoch 197 of Testnet started on timestamp: 1649103616 which sounds odd to me cause it would be at 08:20PM UTC and from what I know, epoch starts at 09:45PM UTC.
Am I missing something?
Edit2: Here's the script that I built after the answer was given to me. I am not an expert on BASH but I does the work, feel free to contact me if you need help with it or have any improvement/suggestions. Link to the script