mirror of
https://github.com/Qortal/qortal.git
synced 2025-02-14 11:15:49 +00:00
Fix up after epic git history rebuild due to LFS issue
This commit is contained in:
parent
fa0b7615a6
commit
8a0d93f304
@ -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
|
||||
|
@ -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.
|
||||
* <p>
|
||||
* 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.
|
||||
* <p>
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user