From 8a0d93f3044cdf2bb8039e3f5b1375534d780569 Mon Sep 17 00:00:00 2001 From: catbref Date: Tue, 13 Aug 2019 10:21:33 +0100 Subject: [PATCH] Fix up after epic git history rebuild due to LFS issue --- log4j2.properties | 2 +- src/main/java/org/qora/block/Block.java | 28 +++---------------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/log4j2.properties b/log4j2.properties index 05bb156a..fba32ebf 100644 --- a/log4j2.properties +++ b/log4j2.properties @@ -1,6 +1,6 @@ rootLogger.level = info # On Windows, uncomment this: -# property.dirname = ${sys:user.home}\\AppData\\Roaming\\MCF\\ +# property.dirname = ${sys:user.home}\\AppData\\Roaming\\qora-core\\ property.filename = ${sys:log4j2.filenameTemplate:-log.txt} rootLogger.appenderRef.console.ref = stdout diff --git a/src/main/java/org/qora/block/Block.java b/src/main/java/org/qora/block/Block.java index da927b2e..e1cf1fe6 100644 --- a/src/main/java/org/qora/block/Block.java +++ b/src/main/java/org/qora/block/Block.java @@ -207,10 +207,6 @@ public class Block { byte[] reference = parentBlockData.getSignature(); BigDecimal generatingBalance = parentBlock.calcNextBlockGeneratingBalance(); - // After a certain height, block timestamps are generated using previous block and generator's public key - if (height >= BlockChain.getInstance().getNewBlockTimestampHeight()) - timestamp = calcTimestamp(parentBlockData, generator.getPublicKey()); - byte[] generatorSignature; try { generatorSignature = generator @@ -259,13 +255,11 @@ public class Block { */ public Block regenerate(PrivateKeyAccount generator) throws DataException { Block newBlock = new Block(this.repository, this.blockData); + newBlock.generator = generator; BlockData parentBlockData = this.getParent(); Block parentBlock = new Block(repository, parentBlockData); - newBlock.generator = generator; - BlockData parentBlockData = newBlock.getParent(); - // Copy AT state data newBlock.ourAtStates = this.ourAtStates; newBlock.atStates = newBlock.ourAtStates; @@ -276,10 +270,6 @@ public class Block { byte[] reference = this.blockData.getReference(); BigDecimal generatingBalance = this.blockData.getGeneratingBalance(); - // After a certain height, block timestamps are generated using previous block and generator's public key - if (height >= BlockChain.getInstance().getNewBlockTimestampHeight()) - timestamp = calcTimestamp(parentBlockData, generator.getPublicKey()); - byte[] generatorSignature; try { generatorSignature = generator @@ -741,21 +731,15 @@ public class Block { } /** - * Returns timestamp based on previous block and this block's generator. + * Returns timestamp based on previous block. *

* For qora-core, we'll using the minimum from BlockChain config. */ - public static long calcTimestamp(BlockData parentBlockData, byte[] generatorPublicKey) { + public static long calcMinimumTimestamp(BlockData parentBlockData) { long minBlockTime = BlockChain.getInstance().getMinBlockTime(); // seconds return parentBlockData.getTimestamp() + (minBlockTime * 1000L); } - public static long calcMinimumTimestamp(BlockData parentBlockData) { - final int thisHeight = parentBlockData.getHeight() + 1; - BlockTimingByHeight blockTiming = BlockChain.getInstance().getBlockTimingByHeight(thisHeight); - return parentBlockData.getTimestamp() + blockTiming.target - blockTiming.deviation; - } - /** * Recalculate block's generator and transactions signatures, thus giving block full signature. *

@@ -824,12 +808,6 @@ public class Block { // if (this.blockData.getTimestamp() < Block.calcMinimumTimestamp(parentBlockData)) // return ValidationResult.TIMESTAMP_TOO_SOON; - if (this.blockData.getHeight() >= BlockChain.getInstance().getNewBlockTimestampHeight()) { - long expectedTimestamp = calcTimestamp(parentBlockData, this.blockData.getGeneratorPublicKey()); - if (this.blockData.getTimestamp() != expectedTimestamp) - return ValidationResult.TIMESTAMP_INCORRECT; - } - return ValidationResult.OK; }