MPH has added a field in their API for a time since the last block:
I added "last_block" field at getminingandprofitsstatistics api as you requested.
It's unixtimestamp number.
Since the pool uses PPLNS, it would be smart to auto extend the interval until a block is found (or end it earlier), otherwise the user would lose all his earnings for the round.
The same applies for YIIMP-based pools as well - they also include "timesincelast" in /api/currencies, which should be used to determine whether the script should switch to next coin or not.
I dont know if this would increase profit as general working mode, you can stay mining one coin and waiting block for hours while there is other coins more profitables at that moment.
Perhaps comparing timesincelast with averagetimeforblock or something to decide if jump or not can work.
It should increase it or never start mining, otherwise the user would lose all his earnings for the round.
I'm thinking of doing these checks:
- before mining: check if
timesincelast (YIIMP) /
time_since_last_block (MPH) > @@INTERVAL (this would mean long blocks, bad pool luck or no pool workers; fails only if a block has been recently found)
- while mining: if the timer is close to the end - keep on increasing it by 30-60s (?) until the block is found, end mining immediately or break it if the extension is longer than 2-3xInterval(?)
Otherwise we'll be blindly mining on pools with long blocks (such as BTG on MPH) or idle pools with no workers and no recent blocks (like the most on the smaller YIIMP pools).
MPH api is refreshed only every 30minutes, so you cant trust timesincelast for this purpose.
But this can be useful for filtering out coins with very few blocks on MPH by filtering out the ones with timesincelast over 1h, for example, since you probably better mine a different coin or on different pool where you have a better chance to hit the block