Make btcrpcclient use the new and consistent reply types.

This commit is contained in:
GeertJohan 2014-05-05 21:23:18 +02:00 committed by Dave Collins
parent 831d0aeb90
commit 0cc22e1134
5 changed files with 17 additions and 17 deletions

View file

@ -126,13 +126,13 @@ func (r FutureGetBlockVerboseResult) Receive() (*btcjson.BlockResult, error) {
} }
// Ensure the returned data is the expected type. // Ensure the returned data is the expected type.
blockResult, ok := reply.(btcjson.BlockResult) blockResult, ok := reply.(*btcjson.BlockResult)
if !ok { if !ok {
return nil, fmt.Errorf("unexpected response type for "+ return nil, fmt.Errorf("unexpected response type for "+
"getblock (verbose=1): %T\n", reply) "getblock (verbose=1): %T\n", reply)
} }
return &blockResult, nil return blockResult, nil
} }
// GetBlockVerboseAsync returns an instance of a type that can be used to get // GetBlockVerboseAsync returns an instance of a type that can be used to get

View file

@ -146,13 +146,13 @@ func (r FutureGetMiningInfoResult) Receive() (*btcjson.GetMiningInfoResult, erro
} }
// Ensure the returned data is the expected type. // Ensure the returned data is the expected type.
result, ok := reply.(btcjson.GetMiningInfoResult) result, ok := reply.(*btcjson.GetMiningInfoResult)
if !ok { if !ok {
return nil, fmt.Errorf("unexpected response type for "+ return nil, fmt.Errorf("unexpected response type for "+
"getmininginfo: %T\n", reply) "getmininginfo: %T\n", reply)
} }
return &result, nil return result, nil
} }
// GetMiningInfoAsync returns an instance of a type that can be used to get // GetMiningInfoAsync returns an instance of a type that can be used to get
@ -286,13 +286,13 @@ func (r FutureGetWork) Receive() (*btcjson.GetWorkResult, error) {
} }
// Ensure the returned data is the expected type. // Ensure the returned data is the expected type.
result, ok := reply.(btcjson.GetWorkResult) result, ok := reply.(*btcjson.GetWorkResult)
if !ok { if !ok {
return nil, fmt.Errorf("unexpected response type for "+ return nil, fmt.Errorf("unexpected response type for "+
"getwork (request data): %T\n", reply) "getwork (request data): %T\n", reply)
} }
return &result, nil return result, nil
} }
// GetWorkAsync returns an instance of a type that can be used to get the result // GetWorkAsync returns an instance of a type that can be used to get the result

4
net.go
View file

@ -297,13 +297,13 @@ func (r FutureGetNetTotalsResult) Receive() (*btcjson.GetNetTotalsResult, error)
} }
// Ensure the returned data is the expected type. // Ensure the returned data is the expected type.
totals, ok := reply.(btcjson.GetNetTotalsResult) totals, ok := reply.(*btcjson.GetNetTotalsResult)
if !ok { if !ok {
return nil, fmt.Errorf("unexpected response type for "+ return nil, fmt.Errorf("unexpected response type for "+
"getnettotals: %T\n", reply) "getnettotals: %T\n", reply)
} }
return &totals, nil return totals, nil
} }
// GetNetTotalsAsync returns an instance of a type that can be used to get the // GetNetTotalsAsync returns an instance of a type that can be used to get the

View file

@ -322,7 +322,7 @@ func (r FutureSignRawTransactionResult) Receive() (*btcwire.MsgTx, bool, error)
} }
// Ensure the returned data is the expected type. // Ensure the returned data is the expected type.
result, ok := reply.(btcjson.SignRawTransactionResult) result, ok := reply.(*btcjson.SignRawTransactionResult)
if !ok { if !ok {
return nil, false, fmt.Errorf("unexpected response type for "+ return nil, false, fmt.Errorf("unexpected response type for "+
"signrawtransaction: %T\n", reply) "signrawtransaction: %T\n", reply)

View file

@ -29,13 +29,13 @@ func (r FutureGetTransactionResult) Receive() (*btcjson.GetTransactionResult, er
} }
// Ensure the returned data is the expected type. // Ensure the returned data is the expected type.
result, ok := reply.(btcjson.GetTransactionResult) result, ok := reply.(*btcjson.GetTransactionResult)
if !ok { if !ok {
return nil, fmt.Errorf("unexpected response type for "+ return nil, fmt.Errorf("unexpected response type for "+
"gettransaction: %T\n", reply) "gettransaction: %T\n", reply)
} }
return &result, nil return result, nil
} }
// GetTransactionAsync returns an instance of a type that can be used to get the // GetTransactionAsync returns an instance of a type that can be used to get the
@ -173,13 +173,13 @@ func (r FutureListSinceBlockResult) Receive() (*btcjson.ListSinceBlockResult, er
} }
// Ensure the returned data is the expected type. // Ensure the returned data is the expected type.
listResult, ok := reply.(btcjson.ListSinceBlockResult) listResult, ok := reply.(*btcjson.ListSinceBlockResult)
if !ok { if !ok {
return nil, fmt.Errorf("unexpected response type for "+ return nil, fmt.Errorf("unexpected response type for "+
"listsinceblock: %T\n", reply) "listsinceblock: %T\n", reply)
} }
return &listResult, nil return listResult, nil
} }
// ListSinceBlockAsync returns an instance of a type that can be used to get // ListSinceBlockAsync returns an instance of a type that can be used to get
@ -690,13 +690,13 @@ func (r FutureCreateMultisigResult) Receive() (*btcjson.CreateMultiSigResult, er
} }
// Ensure the returned data is the expected type. // Ensure the returned data is the expected type.
result, ok := reply.(btcjson.CreateMultiSigResult) result, ok := reply.(*btcjson.CreateMultiSigResult)
if !ok { if !ok {
return nil, fmt.Errorf("unexpected response type for "+ return nil, fmt.Errorf("unexpected response type for "+
"createmultisig: %T\n", reply) "createmultisig: %T\n", reply)
} }
return &result, nil return result, nil
} }
// CreateMultisigAsync returns an instance of a type that can be used to get // CreateMultisigAsync returns an instance of a type that can be used to get
@ -1001,13 +1001,13 @@ func (r FutureValidateAddressResult) Receive() (*btcjson.ValidateAddressResult,
} }
// Ensure the returned data is the expected type. // Ensure the returned data is the expected type.
result, ok := reply.(btcjson.ValidateAddressResult) result, ok := reply.(*btcjson.ValidateAddressResult)
if !ok { if !ok {
return nil, fmt.Errorf("unexpected response type for "+ return nil, fmt.Errorf("unexpected response type for "+
"validateaddress: %T\n", reply) "validateaddress: %T\n", reply)
} }
return &result, nil return result, nil
} }
// ValidateAddressAsync returns an instance of a type that can be used to get // ValidateAddressAsync returns an instance of a type that can be used to get