Changed to read/write mutex locks
Also seperated locks for different rpc calls for a  miner to make it more atomic.