getDifficulty method

double getDifficulty()

Returns the difficulty target of this block header

Implementation

double getDifficulty() {

    int nShift = (_bits! >> 24) & 0xff;
    double dDiff = 0x0000ffff / (_bits! & 0x00ffffff);

    while (nShift < 29) {
        dDiff *= 256.0;
        nShift++;
    }
    while (nShift > 29) {
        dDiff /= 256.0;
        nShift--;
    }

    return double.parse(dDiff.toStringAsFixed(8));

}