aboutsummaryrefslogtreecommitdiffstats
path: root/consensus/consensus.go
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2017-12-22 20:37:50 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-12-22 20:37:50 +0800
commit5f8888e11606296c9582496974c0f6b96a882146 (patch)
treeef8139ff20ae33eb5a236290d5107dd808e34340 /consensus/consensus.go
parent9dbb8ef4aadb8e40aef8b681cf86acd20789abdc (diff)
downloadgo-tangerine-5f8888e11606296c9582496974c0f6b96a882146.tar
go-tangerine-5f8888e11606296c9582496974c0f6b96a882146.tar.gz
go-tangerine-5f8888e11606296c9582496974c0f6b96a882146.tar.bz2
go-tangerine-5f8888e11606296c9582496974c0f6b96a882146.tar.lz
go-tangerine-5f8888e11606296c9582496974c0f6b96a882146.tar.xz
go-tangerine-5f8888e11606296c9582496974c0f6b96a882146.tar.zst
go-tangerine-5f8888e11606296c9582496974c0f6b96a882146.zip
accounts, consensus, core, eth: make chain maker consensus agnostic (#15497)
* accounts, consensus, core, eth: make chain maker consensus agnostic * consensus, core: move CalcDifficulty to Engine interface * consensus: add docs for calcDifficulty function * consensus, core: minor comment fixups
Diffstat (limited to 'consensus/consensus.go')
-rw-r--r--consensus/consensus.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/consensus/consensus.go b/consensus/consensus.go
index 865238cee..be5e661c1 100644
--- a/consensus/consensus.go
+++ b/consensus/consensus.go
@@ -23,6 +23,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
+ "math/big"
)
// ChainReader defines a small collection of methods needed to access the local
@@ -88,6 +89,10 @@ type Engine interface {
// seal place on top.
Seal(chain ChainReader, block *types.Block, stop <-chan struct{}) (*types.Block, error)
+ // CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty
+ // that a new block should have.
+ CalcDifficulty(chain ChainReader, time uint64, parent *types.Header) *big.Int
+
// APIs returns the RPC APIs this consensus engine provides.
APIs(chain ChainReader) []rpc.API
}