Optimized share validation for node-cryptonote-pool backported from Wolf's cpuminer-multi