Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

[IBFT] Block difficulty is one #217

Closed
wants to merge 10 commits into from
2 changes: 1 addition & 1 deletion chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (
GenesisGasLimit uint64 = 4712388

// GenesisDifficulty is the default difficulty of the Genesis block.
GenesisDifficulty = big.NewInt(131072)
GenesisDifficulty = big.NewInt(1)
zivkovicmilos marked this conversation as resolved.
Show resolved Hide resolved
)

// Chain is the blockchain chain configuration
Expand Down
4 changes: 2 additions & 2 deletions consensus/ibft/ibft.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ func (i *Ibft) buildBlock(snap *Snapshot, parent *types.Header) (*types.Block, e
Miner: types.Address{},
Nonce: types.Nonce{},
MixHash: IstanbulDigest,
Difficulty: parent.Number + 1, // we need to do this because blockchain needs difficulty to organize blocks and forks
Difficulty: 1, // we need to do this because blockchain needs difficulty to organize blocks and forks
zivkovicmilos marked this conversation as resolved.
Show resolved Hide resolved
StateRoot: types.EmptyRootHash, // this avoids needing state for now
Sha3Uncles: types.EmptyUncleHash,
GasLimit: parent.GasLimit, // Inherit from parent for now, will need to adjust dynamically later.
Expand Down Expand Up @@ -901,7 +901,7 @@ func (i *Ibft) verifyHeaderImpl(snap *Snapshot, parent, header *types.Header) er
}

// difficulty has to match number
if header.Difficulty != header.Number {
if header.Difficulty != 1 {
return fmt.Errorf("wrong difficulty")
}

Expand Down
2 changes: 1 addition & 1 deletion consensus/ibft/ibft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ func (m *mockIbft) DummyBlock() *types.Block {
block := &types.Block{
Header: &types.Header{
Number: num,
Difficulty: num,
Difficulty: 1,
ParentHash: parent.Hash,
ExtraData: parent.ExtraData,
MixHash: IstanbulDigest,
Expand Down