mirror of
https://github.com/btcsuite/btcd.git
synced 2024-11-19 01:40:07 +01:00
btcjson: Add versionHex to getblock[header] results
rpcserver: Set versionHex in responses.
This commit is contained in:
parent
9cdc1b8afd
commit
2e93ea6ca6
@ -14,6 +14,7 @@ type GetBlockHeaderVerboseResult struct {
|
||||
Confirmations uint64 `json:"confirmations"`
|
||||
Height int32 `json:"height"`
|
||||
Version int32 `json:"version"`
|
||||
VersionHex string `json:"versionHex"`
|
||||
MerkleRoot string `json:"merkleroot"`
|
||||
Time int64 `json:"time"`
|
||||
Nonce uint64 `json:"nonce"`
|
||||
@ -32,6 +33,7 @@ type GetBlockVerboseResult struct {
|
||||
Size int32 `json:"size"`
|
||||
Height int64 `json:"height"`
|
||||
Version int32 `json:"version"`
|
||||
VersionHex string `json:"versionHex"`
|
||||
MerkleRoot string `json:"merkleroot"`
|
||||
Tx []string `json:"tx,omitempty"`
|
||||
RawTx []TxRawResult `json:"rawtx,omitempty"`
|
||||
|
@ -1082,6 +1082,7 @@ func handleGetBlock(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (i
|
||||
blockReply := btcjson.GetBlockVerboseResult{
|
||||
Hash: c.Hash,
|
||||
Version: blockHeader.Version,
|
||||
VersionHex: fmt.Sprintf("%08x", blockHeader.Version),
|
||||
MerkleRoot: blockHeader.MerkleRoot.String(),
|
||||
PreviousHash: blockHeader.PrevBlock.String(),
|
||||
Nonce: blockHeader.Nonce,
|
||||
@ -1202,6 +1203,7 @@ func handleGetBlockHeader(s *rpcServer, cmd interface{}, closeChan <-chan struct
|
||||
Confirmations: uint64(1 + best.Height - blockHeight),
|
||||
Height: blockHeight,
|
||||
Version: blockHeader.Version,
|
||||
VersionHex: fmt.Sprintf("%08x", blockHeader.Version),
|
||||
MerkleRoot: blockHeader.MerkleRoot.String(),
|
||||
NextHash: nextHashString,
|
||||
PreviousHash: blockHeader.PrevBlock.String(),
|
||||
|
@ -186,6 +186,7 @@ var helpDescsEnUS = map[string]string{
|
||||
"getblockverboseresult-size": "The size of the block",
|
||||
"getblockverboseresult-height": "The height of the block in the block chain",
|
||||
"getblockverboseresult-version": "The block version",
|
||||
"getblockverboseresult-versionHex": "The block version in hexidecimal",
|
||||
"getblockverboseresult-merkleroot": "Root hash of the merkle tree",
|
||||
"getblockverboseresult-tx": "The transaction hashes (only when verbosetx=false)",
|
||||
"getblockverboseresult-rawtx": "The transactions as JSON objects (only when verbosetx=true)",
|
||||
@ -218,6 +219,7 @@ var helpDescsEnUS = map[string]string{
|
||||
"getblockheaderverboseresult-confirmations": "The number of confirmations",
|
||||
"getblockheaderverboseresult-height": "The height of the block in the block chain",
|
||||
"getblockheaderverboseresult-version": "The block version",
|
||||
"getblockheaderverboseresult-versionHex": "The block version in hexidecimal",
|
||||
"getblockheaderverboseresult-merkleroot": "Root hash of the merkle tree",
|
||||
"getblockheaderverboseresult-time": "The block time in seconds since 1 Jan 1970 GMT",
|
||||
"getblockheaderverboseresult-nonce": "The block nonce",
|
||||
|
Loading…
Reference in New Issue
Block a user