Move GetBestBlockResult to btcws.
This commit is contained in:
parent
fba205f27e
commit
66b02e7b77
1 changed files with 2 additions and 10 deletions
12
rpcclient.go
12
rpcclient.go
|
@ -291,21 +291,13 @@ func unmarshalNotification(s string) (btcjson.Cmd, error) {
|
||||||
return req, nil
|
return req, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBestBlockResult holds the result of a getbestblock response.
|
|
||||||
//
|
|
||||||
// TODO(jrick): shove this in btcws.
|
|
||||||
type GetBestBlockResult struct {
|
|
||||||
Hash string `json:"hash"`
|
|
||||||
Height int32 `json:"height"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetBestBlock gets both the block height and hash of the best block
|
// GetBestBlock gets both the block height and hash of the best block
|
||||||
// in the main chain.
|
// in the main chain.
|
||||||
func GetBestBlock(rpc ServerConn) (*GetBestBlockResult, *btcjson.Error) {
|
func GetBestBlock(rpc ServerConn) (*btcws.GetBestBlockResult, *btcjson.Error) {
|
||||||
cmd := btcws.NewGetBestBlockCmd(<-NewJSONID)
|
cmd := btcws.NewGetBestBlockCmd(<-NewJSONID)
|
||||||
response := <-rpc.SendRequest(NewServerRequest(cmd))
|
response := <-rpc.SendRequest(NewServerRequest(cmd))
|
||||||
|
|
||||||
var resultData GetBestBlockResult
|
var resultData btcws.GetBestBlockResult
|
||||||
_, jsonErr := response.FinishUnmarshal(&resultData)
|
_, jsonErr := response.FinishUnmarshal(&resultData)
|
||||||
if jsonErr != nil {
|
if jsonErr != nil {
|
||||||
return nil, jsonErr
|
return nil, jsonErr
|
||||||
|
|
Loading…
Add table
Reference in a new issue