Commit Graph

2 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
2b6370dfd7
chaincfg: use DeploymentStarter/DeploymentEnder instead of start/end times
In this commit, we utilize the recently added ConsensusDeploymentStarter
and ConsensusDeploymentEnder interfaces. Concrete implementations of
this interface based on the median time past comparison are used now in
the ConsensusDeployment struct instead of hard coded start/end times.

Along the way, we had to switch to using the "zero time": time.Time{},
in place of 0 and math.MaxInt64 as comparison (After/Before) seems to be
broken in the Go stdlib for times very far in the future. It appears Go
isn't ready to handle the heat death of the universe.
2022-01-25 15:27:37 -08:00
Olaoluwa Osuntokun
dc4dc15d8c
chaincfg: create new abstract deployment starter/ender interfaces
In this commit, we create a series of new interfaces that'll allow us to
abstract "when" exactly a deployment starts and ends. As is, all
deployments start/end based on a unix timestamp, which is compared
against the MTP of a given block to determine if a new deployment has
started or ended. This works fine for BIP 9 which uses time based
timeouts, but not so much for BIP 8. In order to prep a future refactor
that allows our version bits implementation to support both time and
block based start/end times, this new abstraction has been introduced.
2022-01-25 15:27:30 -08:00