blockchain: TimeSource is required.
This commit is contained in:
parent
7c0fd83c87
commit
406ddd17d3
2 changed files with 4 additions and 0 deletions
|
@ -1683,6 +1683,9 @@ func New(config *Config) (*BlockChain, error) {
|
|||
if config.ChainParams == nil {
|
||||
return nil, AssertError("blockchain.New chain parameters nil")
|
||||
}
|
||||
if config.TimeSource == nil {
|
||||
return nil, AssertError("blockchain.New timesource is nil")
|
||||
}
|
||||
|
||||
// Generate a checkpoint by height map from the provided checkpoints.
|
||||
params := config.ChainParams
|
||||
|
|
|
@ -153,6 +153,7 @@ func main() {
|
|||
chain, err := blockchain.New(&blockchain.Config{
|
||||
DB: db,
|
||||
ChainParams: activeNetParams,
|
||||
TimeSource: blockchain.NewMedianTime(),
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "failed to initialize chain: %v\n", err)
|
||||
|
|
Loading…
Reference in a new issue