mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-05-20 22:06:42 +00:00

* Rename IncludeTransactionVerboseData flag to IncludeTransactions * Regenerate auto-generated files
24 lines
772 B
Go
24 lines
772 B
Go
package rpcclient
|
|
|
|
import "github.com/kaspanet/kaspad/app/appmessage"
|
|
|
|
// GetBlock sends an RPC request respective to the function's name and returns the RPC server's response
|
|
func (c *RPCClient) GetBlock(hash string, includeTransactions bool) (
|
|
*appmessage.GetBlockResponseMessage, error) {
|
|
|
|
err := c.rpcRouter.outgoingRoute().Enqueue(
|
|
appmessage.NewGetBlockRequestMessage(hash, includeTransactions))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
response, err := c.route(appmessage.CmdGetBlockResponseMessage).DequeueWithTimeout(c.timeout)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
GetBlockResponse := response.(*appmessage.GetBlockResponseMessage)
|
|
if GetBlockResponse.Error != nil {
|
|
return nil, c.convertRPCError(GetBlockResponse.Error)
|
|
}
|
|
return GetBlockResponse, nil
|
|
}
|