AvailableCoins: acquire cs_main mutex

It's required when called from WalletModel
Merge pull request #4371

ea3acaf AvailableCoins: acquire cs_main mutex (Pavel Vasin)
Refactor proof of work related functions out of main
move pow constants to chainparams
replace ComputeMinWork with CheckMinWork