Skip to content

Commit

Permalink
mark
Browse files Browse the repository at this point in the history
  • Loading branch information
sichengwen committed Jun 16, 2024
1 parent f21b705 commit 497cb7d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Difficulty;

/** 链头指的是最新生成的Block */
/** Head of a blockchain. */
public final class ChainHead {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

public class DefaultBlockchainTest {

// 初始化一个新的chain
@Test
public void initializeNew() {
final BlockDataGenerator gen = new BlockDataGenerator();
Expand All @@ -58,12 +59,20 @@ public void initializeNew() {
final DefaultBlockchain blockchain =
createMutableBlockchain(kvStore, kvStoreVariables, genesisBlock);

// 从chain中获取的block与这里的block一致
assertBlockDataIsStored(blockchain, genesisBlock, Collections.emptyList());

// header中的hash与block中的hash一致
assertBlockIsHead(blockchain, genesisBlock);

// 校验区块难度
assertTotalDifficultiesAreConsistent(blockchain, genesisBlock);

// check forks chain
assertThat(blockchain.getForks()).isEmpty();
}

// 初始化一个已有数据的链
@Test
public void initializeExisting() {
final BlockDataGenerator gen = new BlockDataGenerator();
Expand Down

0 comments on commit 497cb7d

Please sign in to comment.