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 {
|
if config.ChainParams == nil {
|
||||||
return nil, AssertError("blockchain.New chain parameters 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.
|
// Generate a checkpoint by height map from the provided checkpoints.
|
||||||
params := config.ChainParams
|
params := config.ChainParams
|
||||||
|
|
|
@ -153,6 +153,7 @@ func main() {
|
||||||
chain, err := blockchain.New(&blockchain.Config{
|
chain, err := blockchain.New(&blockchain.Config{
|
||||||
DB: db,
|
DB: db,
|
||||||
ChainParams: activeNetParams,
|
ChainParams: activeNetParams,
|
||||||
|
TimeSource: blockchain.NewMedianTime(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "failed to initialize chain: %v\n", err)
|
fmt.Fprintf(os.Stderr, "failed to initialize chain: %v\n", err)
|
||||||
|
|
Loading…
Reference in a new issue