mirror of
https://github.com/btcsuite/btcd.git
synced 2024-11-19 01:40:07 +01:00
blockchain: TimeSource is required.
This commit is contained in:
parent
7c0fd83c87
commit
406ddd17d3
@ -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 New Issue
Block a user