Move GetBestBlockResult to btcws.

This commit is contained in:
Josh Rickmar 2014-04-10 16:43:11 -05:00
parent fba205f27e
commit 66b02e7b77

View file

@ -291,21 +291,13 @@ func unmarshalNotification(s string) (btcjson.Cmd, error) {
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
// in the main chain.
func GetBestBlock(rpc ServerConn) (*GetBestBlockResult, *btcjson.Error) {
func GetBestBlock(rpc ServerConn) (*btcws.GetBestBlockResult, *btcjson.Error) {
cmd := btcws.NewGetBestBlockCmd(<-NewJSONID)
response := <-rpc.SendRequest(NewServerRequest(cmd))
var resultData GetBestBlockResult
var resultData btcws.GetBestBlockResult
_, jsonErr := response.FinishUnmarshal(&resultData)
if jsonErr != nil {
return nil, jsonErr