Coverage Summary for Class: GenesisHeader (org.ethereum.core)
Class |
Class, %
|
Method, %
|
Line, %
|
GenesisHeader |
100%
(1/1)
|
66.7%
(2/3)
|
55.6%
(10/18)
|
1 package org.ethereum.core;
2
3 import co.rsk.core.BlockDifficulty;
4 import co.rsk.core.Coin;
5 import co.rsk.core.RskAddress;
6 import org.bouncycastle.pqc.math.linearalgebra.ByteUtils;
7 import org.ethereum.crypto.HashUtil;
8 import org.ethereum.util.ByteUtil;
9 import org.ethereum.util.RLP;
10
11 public class GenesisHeader extends BlockHeader {
12
13 private final byte[] difficulty;
14
15 public GenesisHeader(byte[] parentHash,
16 byte[] unclesHash,
17 byte[] logsBloom,
18 byte[] difficulty,
19 long number,
20 byte[] gasLimit,
21 long gasUsed,
22 long timestamp,
23 byte[] extraData,
24 byte[] bitcoinMergedMiningHeader,
25 byte[] bitcoinMergedMiningMerkleProof,
26 byte[] bitcoinMergedMiningCoinbaseTransaction,
27 byte[] minimumGasPrice,
28 boolean useRskip92Encoding,
29 byte[] coinbase,
30 byte[] stateRootHash) {
31 super(
32 parentHash,
33 unclesHash,
34 new RskAddress(coinbase),
35 stateRootHash,
36 ByteUtils.clone(HashUtil.EMPTY_TRIE_HASH),
37 ByteUtils.clone(HashUtil.EMPTY_TRIE_HASH),
38 logsBloom,
39 RLP.parseBlockDifficulty(difficulty),
40 number,
41 ByteUtil.stripLeadingZeroes(gasLimit),
42 gasUsed,
43 timestamp,
44 extraData,
45 Coin.ZERO,
46 bitcoinMergedMiningHeader,
47 bitcoinMergedMiningMerkleProof,
48 bitcoinMergedMiningCoinbaseTransaction,
49 new byte[0],
50 RLP.parseSignedCoinNonNullZero(minimumGasPrice),
51 0,
52 false,
53 useRskip92Encoding,
54 false,
55 null);
56 this.difficulty = ByteUtils.clone(difficulty);
57 }
58
59 public GenesisHeader(byte[] parentHash,
60 byte[] unclesHash,
61 byte[] logsBloom,
62 byte[] difficulty,
63 long number,
64 byte[] gasLimit,
65 long gasUsed,
66 long timestamp,
67 byte[] extraData,
68 byte[] bitcoinMergedMiningHeader,
69 byte[] bitcoinMergedMiningMerkleProof,
70 byte[] bitcoinMergedMiningCoinbaseTransaction,
71 byte[] minimumGasPrice,
72 boolean useRskip92Encoding,
73 byte[] coinbase) {
74 super(
75 parentHash,
76 unclesHash,
77 new RskAddress(coinbase),
78 ByteUtils.clone(HashUtil.EMPTY_TRIE_HASH),
79 ByteUtils.clone(HashUtil.EMPTY_TRIE_HASH),
80 ByteUtils.clone(HashUtil.EMPTY_TRIE_HASH),
81 logsBloom,
82 RLP.parseBlockDifficulty(difficulty),
83 number,
84 ByteUtil.stripLeadingZeroes(gasLimit),
85 gasUsed,
86 timestamp,
87 extraData,
88 Coin.ZERO,
89 bitcoinMergedMiningHeader,
90 bitcoinMergedMiningMerkleProof,
91 bitcoinMergedMiningCoinbaseTransaction,
92 new byte[0],
93 RLP.parseSignedCoinNonNullZero(minimumGasPrice),
94 0,
95 false,
96 useRskip92Encoding,
97 false,
98 null);
99 this.difficulty = ByteUtils.clone(difficulty);
100 }
101
102 @Override
103 protected byte[] encodeBlockDifficulty(BlockDifficulty ignored) {
104 return RLP.encodeElement(difficulty);
105 }
106 }