Implement stake kernel mining as a separate function

This change allows us to reduce amount of intermediatte operations, such as header hashing or modifier calculation. As the result, we've got ~20x drop of CPU load and 60x boost of kernel scanning speed.