rpc

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2023 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHeader

type BlockHeader struct {
	BlockSize    int    `json:"block_size"`
	Depth        int    `json:"depth"`
	Difficulty   int64  `json:"difficulty"`
	Hash         string `json:"hash"`
	Height       int    `json:"height"`
	MajorVersion int    `json:"major_version"`
	MinorVersion int    `json:"minor_version"`
	Nonce        uint32 `json:"nonce"`
	NumTxes      int    `json:"num_txes"`
	OrphanStatus bool   `json:"orphan_status"`
	PrevHash     string `json:"prev_hash"`
	Reward       int64  `json:"reward"`
	Timestamp    uint32 `json:"timestamp"`
}

type GetBlockCountReply

type GetBlockCountReply struct {
	Count  int64  `json:"count"`
	Status string `json:"status"`
}

type GetBlockHeaderReply

type GetBlockHeaderReply struct {
	BlockHeader BlockHeader `json:"block_header"`
	Status      string      `json:"status"`
	Untrusted   bool        `json:"untrusted"`
}

type GetBlockTemplateReply

type GetBlockTemplateReply struct {
	Difficulty     int64  `json:"difficulty"`
	Height         int64  `json:"height"`
	Blob           string `json:"blocktemplate_blob"`
	ReservedOffset int    `json:"reserved_offset"`
	PrevHash       string `json:"prev_hash"`

	ExpectedReward int64  `json:"expected_reward"`
	SeedHash       string `json:"seed_hash"`
	NextSeedHash   string `json:"next_seed_hash"`
}

type GetInfoReply

type GetInfoReply struct {
	IncomingConnections int64  `json:"incoming_connections_count"`
	OutgoingConnections int64  `json:"outgoing_connections_count"`
	Height              int64  `json:"height"`
	TxPoolSize          int64  `json:"tx_pool_size"`
	Status              string `json:"status"`
}

type JSONRpcResp

type JSONRpcResp struct {
	Id     *json.RawMessage       `json:"id"`
	Result *json.RawMessage       `json:"result"`
	Error  map[string]interface{} `json:"error"`
}

type RPCClient

type RPCClient struct {
	sync.RWMutex

	Accepts          int64
	Rejects          int64
	LastSubmissionAt int64
	FailsCount       int64
	Url              *url.URL
	//login            string
	//password         string
	Name string
	// contains filtered or unexported fields
}

func NewRPCClient

func NewRPCClient(cfg *pool.Upstream) (*RPCClient, error)

func (*RPCClient) Check

func (r *RPCClient) Check(reserveSize int, address string) (bool, error)

func (*RPCClient) GetBlockCount

func (r *RPCClient) GetBlockCount() (*GetBlockCountReply, error)

func (*RPCClient) GetBlockHeaderByHeight

func (r *RPCClient) GetBlockHeaderByHeight(height int64) (*GetBlockHeaderReply, error)

func (*RPCClient) GetBlockTemplate

func (r *RPCClient) GetBlockTemplate(reserveSize int, address string) (*GetBlockTemplateReply, error)

func (*RPCClient) GetInfo

func (r *RPCClient) GetInfo() (*GetInfoReply, error)

func (*RPCClient) Info

func (r *RPCClient) Info() *GetInfoReply

func (*RPCClient) SetClient

func (r *RPCClient) SetClient(client *http.Client)

func (*RPCClient) Sick

func (r *RPCClient) Sick() bool

func (*RPCClient) SubmitBlock

func (r *RPCClient) SubmitBlock(hash string) (*JSONRpcResp, error)

func (*RPCClient) UpdateInfo

func (r *RPCClient) UpdateInfo() (*GetInfoReply, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL