/// <summary>
/// Returns the difficulty target as a 256 bit value that can be compared to a SHA-256 hash. Inside a block the
/// target is represented using a compact form. If this form decodes to a value that is out of bounds,
/// an exception is thrown.
/// </summary>
/// <exception cref="VerificationException"/>
public BigInteger GetDifficultyTargetAsInteger()
{
var target = Utils.DecodeCompactBits(_difficultyTarget);
if (target.CompareTo(BigInteger.Zero) <= 0 || target.CompareTo(Params.ProofOfWorkLimit) > 0)
{
throw new VerificationException("Difficulty target is bad: " + target);
}
return(target);
}