mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
consensus: add docs for calcDifficulty function
This commit is contained in:
parent
fdffaf31c4
commit
993267d311
2 changed files with 2 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue