btcjson: use correct json tag for Bip9SoftForkDescription.StartTime

This commit is contained in:
Wilmer Paulino 2019-10-29 18:51:12 -07:00
parent 266851e329
commit 93a84aa014
No known key found for this signature in database
GPG key ID: 6DF57B9F9514972F
2 changed files with 18 additions and 9 deletions

View file

@ -90,11 +90,20 @@ type SoftForkDescription struct {
// Bip9SoftForkDescription describes the current state of a defined BIP0009 // Bip9SoftForkDescription describes the current state of a defined BIP0009
// version bits soft-fork. // version bits soft-fork.
type Bip9SoftForkDescription struct { type Bip9SoftForkDescription struct {
Status string `json:"status"` Status string `json:"status"`
Bit uint8 `json:"bit"` Bit uint8 `json:"bit"`
StartTime int64 `json:"startTime"` StartTime1 int64 `json:"startTime"`
Timeout int64 `json:"timeout"` StartTime2 int64 `json:"start_time"`
Since int32 `json:"since"` Timeout int64 `json:"timeout"`
Since int32 `json:"since"`
}
// StartTime returns the starting time of the softfork as a Unix epoch.
func (d *Bip9SoftForkDescription) StartTime() int64 {
if d.StartTime1 != 0 {
return d.StartTime1
}
return d.StartTime2
} }
// SoftForks describes the current softforks enabled by the backend. Softforks // SoftForks describes the current softforks enabled by the backend. Softforks

View file

@ -1284,10 +1284,10 @@ func handleGetBlockChainInfo(s *rpcServer, cmd interface{}, closeChan <-chan str
// Finally, populate the soft-fork description with all the // Finally, populate the soft-fork description with all the
// information gathered above. // information gathered above.
chainInfo.SoftForks.Bip9SoftForks[forkName] = &btcjson.Bip9SoftForkDescription{ chainInfo.SoftForks.Bip9SoftForks[forkName] = &btcjson.Bip9SoftForkDescription{
Status: strings.ToLower(statusString), Status: strings.ToLower(statusString),
Bit: deploymentDetails.BitNumber, Bit: deploymentDetails.BitNumber,
StartTime: int64(deploymentDetails.StartTime), StartTime2: int64(deploymentDetails.StartTime),
Timeout: int64(deploymentDetails.ExpireTime), Timeout: int64(deploymentDetails.ExpireTime),
} }
} }