chain

package
v0.9.3-Beta.0...-73c8f7e Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2018 License: ISC Imports: 8 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

Types

type BlockConnected

type BlockConnected struct {
	BlockHeader  []byte
	Transactions [][]byte
}

BlockConnected is a notification for a newly-attached block to the best chain.

type BlockDisconnected

type BlockDisconnected struct {
	BlockHeader []byte
}

BlockDisconnected is a notifcation that the block described by the BlockStamp was reorganized out of the best chain.

type ClientConnected

type ClientConnected struct{}

ClientConnected is a notification for when a client connection is opened or reestablished to the chain server.

type MissedTickets

type MissedTickets struct {
	BlockHash   *chainhash.Hash
	BlockHeight int64
	Tickets     []*chainhash.Hash
}

MissedTickets is a notifcation for tickets that have been missed.

type RPCClient

type RPCClient struct {
	*hcashrpcclient.Client
	// contains filtered or unexported fields
}

RPCClient represents a persistent client connection to a hypercash RPC server for information regarding the current best block chain.

func NewRPCClient

func NewRPCClient(chainParams *chaincfg.Params, connect, user, pass string, certs []byte,
	disableTLS bool, reconnectAttempts int) (*RPCClient, error)

NewRPCClient creates a client connection to the server described by the connect string. If disableTLS is false, the remote RPC certificate must be provided in the certs slice. The connection is not established immediately, but must be done using the Start method. If the remote server does not operate on the same bitcoin network as described by the passed chain parameters, the connection will be disconnected.

func (*RPCClient) Notifications

func (c *RPCClient) Notifications() <-chan interface{}

Notifications returns a channel of parsed notifications sent by the remote hypercash RPC server. This channel must be continually read or the process may abort for running out memory, as unread notifications are queued for later reads.

func (*RPCClient) NotificationsVoting

func (c *RPCClient) NotificationsVoting() <-chan interface{}

NotificationsVoting returns a channel of parsed voting notifications sent by the remote RPC server. This channel must be continually read or the process may abort for running out memory, as unread notifications are queued for later reads.

func (*RPCClient) POSTClient

func (c *RPCClient) POSTClient() (*hcashrpcclient.Client, error)

POSTClient creates the equivalent HTTP POST hcashrpcclient.Client.

func (*RPCClient) Start

func (c *RPCClient) Start() (err error)

Start attempts to establish a client connection with the remote server. If successful, handler goroutines are started to process notifications sent by the server. After a limited number of connection attempts, this function gives up, and therefore will not block forever waiting for the connection to be established to a server that may not exist.

func (*RPCClient) Stop

func (c *RPCClient) Stop()

Stop disconnects the client and signals the shutdown of all goroutines started by Start.

func (*RPCClient) WaitForShutdown

func (c *RPCClient) WaitForShutdown()

WaitForShutdown blocks until both the client has finished disconnecting and all handlers have exited.

type RelevantTxAccepted

type RelevantTxAccepted struct {
	Transaction []byte
}

RelevantTxAccepted is a notification that a transaction accepted by mempool passed the client's transaction filter.

type Reorganization

type Reorganization struct {
	OldHash   *chainhash.Hash
	OldHeight int64
	NewHash   *chainhash.Hash
	NewHeight int64
}

Reorganization is a notification that a reorg has happen with the new old and new tip included.

type StakeDifficulty

type StakeDifficulty struct {
	BlockHash   *chainhash.Hash
	BlockHeight int64
	StakeDiff   int64
}

StakeDifficulty is a notification for the current stake difficulty.

type WinningTickets

type WinningTickets struct {
	BlockHash      *chainhash.Hash
	BlockHeight    int64
	BlockKeyHeight int64
	Tickets        []*chainhash.Hash
}

WinningTickets is a notification with the winning tickets (and the block they are in.

Jump to

Keyboard shortcuts

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