blockchain: TimeSource is required.

This commit is contained in:
David Hill 2017-01-12 11:19:51 -05:00
parent 7c0fd83c87
commit 406ddd17d3
2 changed files with 4 additions and 0 deletions

View File

@ -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

View File

@ -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)