Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Fix the difficulty judgment logic of PoW. #1287

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public long mine(long fullSize, int[] dataset, byte[] blockHeaderTruncHash, long
nonce++;
Pair<byte[], byte[]> pair = hashimotoFull(fullSize, dataset, blockHeaderTruncHash, longToBytes(nonce));
BigInteger h = new BigInteger(1, pair.getRight() /* ?? */);
if (h.compareTo(target) < 0) break;
if (h.compareTo(target) <= 0) break;
}
return nonce;
}
Expand All @@ -236,7 +236,7 @@ public long mineLight(long fullSize, final int[] cache, byte[] blockHeaderTruncH
nonce++;
Pair<byte[], byte[]> pair = hashimotoLight(fullSize, cache, blockHeaderTruncHash, longToBytes(nonce));
BigInteger h = new BigInteger(1, pair.getRight() /* ?? */);
if (h.compareTo(target) < 0) break;
if (h.compareTo(target) <= 0) break;
}
return nonce;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public long mine(long fullSize, byte[][] dataset, byte[] blockHeaderTruncHash, l
nonce++;
Pair<byte[], byte[]> pair = hashimotoFull(fullSize, dataset, blockHeaderTruncHash, longToBytes(nonce));
BigInteger h = new BigInteger(1, pair.getRight() /* ?? */);
if (h.compareTo(target) < 0) break;
if (h.compareTo(target) <= 0) break;
}
return nonce;
}
Expand All @@ -197,7 +197,7 @@ public long mineLight(long fullSize, final byte[][] cache, byte[] blockHeaderTru
nonce++;
Pair<byte[], byte[]> pair = hashimotoLight(fullSize, cache, blockHeaderTruncHash, longToBytes(nonce));
BigInteger h = new BigInteger(1, pair.getRight() /* ?? */);
if (h.compareTo(target) < 0) break;
if (h.compareTo(target) <= 0) break;
}
return nonce;
}
Expand Down