Fix incorrect PoW buffer usage length in verify & adjust difficulties

CHAT: 8 or 14
MESSAGE: 14
PUBLICIZE: 15
Handshake: 8

Added test to cover verify bug
This commit is contained in:
catbref
2020-06-10 10:09:06 +01:00
parent e0398490ae
commit a338202ded
5 changed files with 60 additions and 37 deletions

View File

@@ -66,7 +66,7 @@ public class MemoryPoW {
byteBuffer = null;
int longBufferLength = workBufferLength / 8;
long[] workBuffer = new long[longBufferLength / 8];
long[] workBuffer = new long[longBufferLength];
long[] state = new long[4];
long seed = 8682522807148012L;

View File

@@ -211,7 +211,7 @@ public enum Handshake {
private static final Pattern VERSION_PATTERN = Pattern.compile(Controller.VERSION_PREFIX + "(\\d{1,3})\\.(\\d{1,5})\\.(\\d{1,5})");
private static final int POW_BUFFER_SIZE = 8 * 1024 * 1024; // bytes
private static final int POW_DIFFICULTY = 12; // leading zero bits
private static final int POW_DIFFICULTY = 8; // leading zero bits
private static final byte[] ZERO_CHALLENGE = new byte[ChallengeMessage.CHALLENGE_LENGTH];

View File

@@ -26,8 +26,8 @@ public class ChatTransaction extends Transaction {
// Other useful constants
public static final int MAX_DATA_SIZE = 256;
public static final int POW_BUFFER_SIZE = 8 * 1024 * 1024; // bytes
public static final int POW_DIFFICULTY_WITH_QORT = 12; // leading zero bits
public static final int POW_DIFFICULTY_NO_QORT = 16; // leading zero bits
public static final int POW_DIFFICULTY_WITH_QORT = 8; // leading zero bits
public static final int POW_DIFFICULTY_NO_QORT = 14; // leading zero bits
// Constructors

View File

@@ -26,7 +26,7 @@ public class PublicizeTransaction extends Transaction {
/** If time difference between transaction and now is greater than this then we don't verify proof-of-work. */
public static final long HISTORIC_THRESHOLD = 2 * 7 * 24 * 60 * 60 * 1000L;
public static final int POW_BUFFER_SIZE = 8 * 1024 * 1024; // bytes
public static final int POW_DIFFICULTY = 18; // leading zero bits
public static final int POW_DIFFICULTY = 15; // leading zero bits
// Constructors