Add comment to Block calculation

This commit is contained in:
nicksavers 2014-06-07 17:49:02 +02:00
parent 9880f3ec15
commit 0dab8330f1
1 changed files with 7 additions and 5 deletions

View File

@ -9,8 +9,6 @@ import org.ethereum.util.RLPElement;
import org.ethereum.util.RLPList; import org.ethereum.util.RLPList;
import org.spongycastle.util.BigIntegers; import org.spongycastle.util.BigIntegers;
import edu.emory.mathcs.backport.java.util.Arrays;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -305,9 +303,8 @@ public class Block {
/** /**
* Calculate GasLimit * Calculate GasLimit
* max(10000, (parent gas limit * (1024 - 1) + (parent gas used * 6 / 5)) / 1024) * See Yellow Paper: http://www.gavwood.com/Paper.pdf - page 5, 4.3.4 (25)
* * @return long value of the gasLimit
* @return
*/ */
public long calcGasLimit() { public long calcGasLimit() {
if (this.isGenesis()) if (this.isGenesis())
@ -318,6 +315,11 @@ public class Block {
} }
} }
/**
* Calculate Difficulty
* See Yellow Paper: http://www.gavwood.com/Paper.pdf - page 5, 4.3.4 (24)
* @return byte array value of the difficulty
*/
public byte[] calcDifficulty() { public byte[] calcDifficulty() {
if (this.isGenesis()) if (this.isGenesis())
return Genesis.DIFFICULTY; return Genesis.DIFFICULTY;