dcrd

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: ISC Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockConnected

func BlockConnected(params json.RawMessage) (header *wire.BlockHeader, relevant []*wire.MsgTx, err error)

BlockConnected extracts the parameters from a blockconnected JSON-RPC notification.

func MissedTickets

func MissedTickets(params json.RawMessage) (missed []*chainhash.Hash, err error)

MissedTickets extracts the missed ticket hashes from the parameters of a spentandmissedtickets JSON-RPC notification.

func RelevantTxAccepted

func RelevantTxAccepted(params json.RawMessage) (tx *wire.MsgTx, err error)

RelevantTxAccepted extracts the parameters from a relevanttxaccepted JSON-RPC notification.

func TSpend

func TSpend(params json.RawMessage) (tx *wire.MsgTx, err error)

TSpend extracts the parameters from a tspend JSON-RPC notification.

func WinningTickets

func WinningTickets(params json.RawMessage) (block *chainhash.Hash, height int32, winners []*chainhash.Hash, err error)

WinningTickets extracts the parameters from a winningtickets JSON-RPC notification.

Types

type Caller

type Caller interface {
	// Call performs the remote procedure call defined by method and
	// waits for a response or a broken client connection.
	// Args provides positional parameters for the call.
	// Res must be a pointer to a struct, slice, or map type to unmarshal
	// a result (if any), or nil if no result is needed.
	Call(ctx context.Context, method string, res interface{}, args ...interface{}) error
}

Caller provides a client interface to perform JSON-RPC remote procedure calls.

type RPC

type RPC struct {
	Caller
}

RPC provides methods for calling dcrd JSON-RPCs without exposing the details of JSON encoding.

func New

func New(caller Caller) *RPC

New creates a new RPC client instance from a caller.

func (*RPC) Blocks

func (r *RPC) Blocks(ctx context.Context, blockHashes []*chainhash.Hash) ([]*wire.MsgBlock, error)

Blocks returns the blocks for each block hash.

func (*RPC) CFilterV2

func (r *RPC) CFilterV2(ctx context.Context, blockHash *chainhash.Hash) (*gcs.FilterV2, uint32, []chainhash.Hash, error)

CFilterV2 returns the version 2 committed filter and the data required for verifying the inclusion proof of the cfilter for a block.

func (*RPC) CFiltersV2

func (r *RPC) CFiltersV2(ctx context.Context, blockHashes []*chainhash.Hash) ([]filterProof, error)

CFiltersV2 returns the version 2 committed filters for blocks.

func (*RPC) ExistsExpiredMissedTickets

func (r *RPC) ExistsExpiredMissedTickets(ctx context.Context, tickets []*chainhash.Hash) (expired, missed bitset.Bytes, err error)

ExistsExpiredMissedTickets returns bitsets identifying whether each ticket is currently expired or missed.

func (*RPC) ExistsLiveExpiredTickets

func (r *RPC) ExistsLiveExpiredTickets(ctx context.Context, tickets []*chainhash.Hash) (live, expired bitset.Bytes, err error)

ExistsLiveExpiredTickets returns bitsets identifying whether each ticket is currently live or expired.

func (*RPC) ExistsLiveTicket

func (r *RPC) ExistsLiveTicket(ctx context.Context, ticket *chainhash.Hash) (bool, error)

ExistsLiveTicket returns whether a ticket identified by its hash is currently live and not immature.

func (*RPC) ExistsLiveTickets

func (r *RPC) ExistsLiveTickets(ctx context.Context, tickets []*chainhash.Hash) (bitset.Bytes, error)

ExistsLiveTickets returns a bitset identifying whether each ticket is currently live.

func (*RPC) GetMempoolTSpends

func (r *RPC) GetMempoolTSpends(ctx context.Context) ([]*wire.MsgTx, error)

GetMempoolTSpends retrieves all mempool tspends.

func (*RPC) Headers

func (r *RPC) Headers(ctx context.Context, blockLocators []*chainhash.Hash, hashStop *chainhash.Hash) ([]*wire.BlockHeader, error)

Headers returns the block headers starting at the fork point between the client and the dcrd server identified by the client's block locators.

func (*RPC) LoadTxFilter

func (r *RPC) LoadTxFilter(ctx context.Context, reload bool, addrs []dcrutil.Address, outpoints []wire.OutPoint) error

LoadTxFilter loads or reloads the precise server-side transaction filter used for relevant transaction notifications and rescans. Addresses and outpoints are added to an existing filter if reload is false.

func (*RPC) MempoolCount

func (r *RPC) MempoolCount(ctx context.Context, kind string) (int, error)

MempoolCount returns the count of a particular kind of transaction in mempool. Kind may be one of:

"all"
"regular"
"tickets"
"votes"
"revocations"

func (*RPC) PublishTransaction

func (r *RPC) PublishTransaction(ctx context.Context, tx *wire.MsgTx) error

PublishTransaction submits the transaction to dcrd mempool for acceptance. If accepted, the transaction is published to other peers. The transaction may not be an orphan.

func (*RPC) PublishTransactions

func (r *RPC) PublishTransactions(ctx context.Context, txs ...*wire.MsgTx) error

PublishTransactions submits each transaction to dcrd mempool for acceptance. If accepted, the transaction is published to other peers. Transactions are sent in order and later transactions may spend outputs of previous transactions. No transaction may be an orphan.

func (*RPC) Rescan

func (r *RPC) Rescan(ctx context.Context, blocks []chainhash.Hash, save func(block *chainhash.Hash, txs []*wire.MsgTx) error) error

Rescan rescans the specified blocks in order, using the loaded transaction filter to determine which transactions are possibly relevant to the client. The save function is called for the discovered transactions from each block.

func (*RPC) StakeDifficulty

func (r *RPC) StakeDifficulty(ctx context.Context) (dcrutil.Amount, error)

StakeDifficulty returns the stake difficulty (AKA ticket price) of the next block.

func (*RPC) UsedAddresses

func (r *RPC) UsedAddresses(ctx context.Context, addrs []dcrutil.Address) (bitset.Bytes, error)

UsedAddresses returns a bitset identifying whether each address has been publically used on the blockchain. This feature requires the optional dcrd existsaddress index to be enabled.

Jump to

Keyboard shortcuts

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