mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-05-21 06:16:45 +00:00

* Add request_types and their help * Added command parser * Updated main to use command if it's specified * Some progress in making everything work * Fix command parser for pointers to structs * Cleanup code * Enhance usage text * Fixed typo * Some minor style fixing, and remove temporary code * Correctly fallthrough in stringToValue unsupported types Co-authored-by: stasatdaglabs <39559713+stasatdaglabs@users.noreply.github.com>
24 lines
792 B
Go
24 lines
792 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, includeTransactionVerboseData bool) (
|
|
*appmessage.GetBlockResponseMessage, error) {
|
|
|
|
err := c.rpcRouter.outgoingRoute().Enqueue(
|
|
appmessage.NewGetBlockRequestMessage(hash, includeTransactionVerboseData))
|
|
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
|
|
}
|