Skip to content

Commit

Permalink
btcjson+rpc: add min activation height to soft fork RPC response
Browse files Browse the repository at this point in the history
  • Loading branch information
Roasbeef committed Jan 25, 2022
1 parent 54f6fa9 commit 0b245cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
15 changes: 8 additions & 7 deletions btcjson/chainsvrresults.go
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
9 changes: 5 additions & 4 deletions rpcserver.go
Expand Up @@ -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),
}
}

Expand Down

0 comments on commit 0b245cc

Please sign in to comment.