Not sure if the title is poorly worded, but here's what I'm looking to do.
If I have a range of blocks and I want to calculate the hashrate, I can do something similar to what is found here.
To take it a step further, I'd like to be able to calculate hashrate for a given number of blocks from the current block. Using the example provided above, this is rather trivial.
However, I'm running into issues doing this when the difficulty changes somewhere within the range of blocks.
Take last night as an example. Difficulty changed to roughly ~390M. Prior to that it was roughly ~267M.
How would I go about calculating an average network hashrate for a given range where the difficulty has changed within that range?
Thank you for the help!