btcjson+rpc: add min activation height to soft fork RPC response

This commit is contained in:
Olaoluwa Osuntokun 2022-01-13 17:51:30 -08:00
parent 54f6fa948e
commit 0b245cca4f
No known key found for this signature in database
GPG key ID: 3BBD59E99B280306
2 changed files with 13 additions and 11 deletions

View file

@ -11,8 +11,8 @@ import (
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/wire"
)
// GetBlockHeaderVerboseResult models the data from the getblockheader command when
@ -172,12 +172,13 @@ type SoftForkDescription struct {
// Bip9SoftForkDescription describes the current state of a defined BIP0009
// version bits soft-fork.
type Bip9SoftForkDescription struct {
Status string `json:"status"`
Bit uint8 `json:"bit"`
StartTime1 int64 `json:"startTime"`
StartTime2 int64 `json:"start_time"`
Timeout int64 `json:"timeout"`
Since int32 `json:"since"`
Status string `json:"status"`
Bit uint8 `json:"bit"`
StartTime1 int64 `json:"startTime"`
StartTime2 int64 `json:"start_time"`
Timeout int64 `json:"timeout"`
Since int32 `json:"since"`
MinActivationHeight int32 `json:"min_activation_height"`
}
// StartTime returns the starting time of the softfork as a Unix epoch.

View file

@ -1297,10 +1297,11 @@ func handleGetBlockChainInfo(s *rpcServer, cmd interface{}, closeChan <-chan str
endTime = ender.EndTime().Unix()
}
chainInfo.SoftForks.Bip9SoftForks[forkName] = &btcjson.Bip9SoftForkDescription{
Status: strings.ToLower(statusString),
Bit: deploymentDetails.BitNumber,
StartTime2: startTime,
Timeout: endTime,
Status: strings.ToLower(statusString),
Bit: deploymentDetails.BitNumber,
StartTime2: startTime,
Timeout: endTime,
MinActivationHeight: int32(deploymentDetails.MinActivationHeight),
}
}