diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index 4db2a27bcb..1b693f75b3 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -661,6 +661,7 @@ func (c *Clique) CalcDifficulty(chain consensus.ChainReader, time uint64, parent return CalcDifficulty(snap, c.signer) } +// CalcDifficulty returns block difficulty according to local signer is the inturn signer or not. func CalcDifficulty(snap *Snapshot, signer common.Address) *big.Int { if snap.inturn(snap.Number+1, signer) { return new(big.Int).Set(diffInTurn) diff --git a/consensus/ethash/consensus.go b/consensus/ethash/consensus.go index eef6fb0df2..34f73d1f42 100644 --- a/consensus/ethash/consensus.go +++ b/consensus/ethash/consensus.go @@ -291,6 +291,7 @@ func (ethash *Ethash) CalcDifficulty(chain consensus.ChainReader, time uint64, p return CalcDifficulty(chain.Config(), time, parent) } +// CalcDifficulty returns block difficulty according to the parent block's time and difficulty. func CalcDifficulty(config *params.ChainConfig, time uint64, parent *types.Header) *big.Int { next := new(big.Int).Add(parent.Number, big1) switch {