Documentation ¶
Index ¶
- func BlockConnected(params json.RawMessage) (header *wire.BlockHeader, relevant []*wire.MsgTx, err error)
- func MixMessage(params json.RawMessage) (msg mixing.Message, err error)
- func RelevantTxAccepted(params json.RawMessage) (tx *wire.MsgTx, err error)
- func TSpend(params json.RawMessage) (tx *wire.MsgTx, err error)
- func WinningTickets(params json.RawMessage) (block *chainhash.Hash, height int32, winners []*chainhash.Hash, err error)
- type Caller
- type RPC
- func (r *RPC) Blocks(ctx context.Context, blockHashes []*chainhash.Hash) ([]*wire.MsgBlock, error)
- func (r *RPC) CFilterV2(ctx context.Context, blockHash *chainhash.Hash) (*gcs.FilterV2, uint32, []chainhash.Hash, error)
- func (r *RPC) CFiltersV2(ctx context.Context, blockHashes []*chainhash.Hash) ([]filterProof, error)
- func (r *RPC) ExistsLiveTicket(ctx context.Context, ticket *chainhash.Hash) (bool, error)
- func (r *RPC) ExistsLiveTickets(ctx context.Context, tickets []*chainhash.Hash) (bitset.Bytes, error)
- func (r *RPC) GetBlockchainInfo(ctx context.Context) (*dcrdtypes.GetBlockChainInfoResult, error)
- func (r *RPC) GetConfirmationHeight(ctx context.Context, txHash *chainhash.Hash) (int32, error)
- func (r *RPC) GetMempoolTSpends(ctx context.Context) ([]*wire.MsgTx, error)
- func (r *RPC) GetTxOut(ctx context.Context, txHash *chainhash.Hash, index uint32, tree int8, ...) (*dcrdtypes.GetTxOutResult, error)
- func (r *RPC) Headers(ctx context.Context, blockLocators []*chainhash.Hash, hashStop *chainhash.Hash) ([]*wire.BlockHeader, error)
- func (r *RPC) LoadTxFilter(ctx context.Context, reload bool, addrs []stdaddr.Address, ...) error
- func (r *RPC) MempoolCount(ctx context.Context, kind string) (int, error)
- func (r *RPC) MixMessage(ctx context.Context, hash *chainhash.Hash) (mixing.Message, error)
- func (r *RPC) MixPairRequests(ctx context.Context) ([]*wire.MsgMixPairReq, error)
- func (r *RPC) PublishMixMessages(ctx context.Context, msgs ...mixing.Message) error
- func (r *RPC) PublishTransaction(ctx context.Context, tx *wire.MsgTx) error
- func (r *RPC) PublishTransactions(ctx context.Context, txs ...*wire.MsgTx) error
- func (r *RPC) Rescan(ctx context.Context, blocks []chainhash.Hash, ...) error
- func (r *RPC) StakeDifficulty(ctx context.Context) (dcrutil.Amount, error)
- func (r *RPC) String() string
- func (r *RPC) UsedAddresses(ctx context.Context, addrs []stdaddr.Address) (bitset.Bytes, error)
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 MixMessage ¶
func MixMessage(params json.RawMessage) (msg mixing.Message, err error)
MixMessage extracts the mixing message from a mixmessage 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 any, args ...any) 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 (*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 ¶
CFiltersV2 returns the version 2 committed filters for blocks. If this method errors, a partial result of filter proofs may be returned, with nil filters if the query errored.
func (*RPC) ExistsLiveTicket ¶
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) GetBlockchainInfo ¶
GetBlockchainInfo returns information about the underlying dcrd node.
func (*RPC) GetConfirmationHeight ¶
GetConfirmationHeight returns the block height of a transaction that has been mined in the mainchain of the underlying node.
NOTE: this requires the node to be running with the transaction index enabled, otherwise it will error.
func (*RPC) GetMempoolTSpends ¶
GetMempoolTSpends retrieves all mempool tspends.
func (*RPC) GetTxOut ¶
func (r *RPC) GetTxOut(ctx context.Context, txHash *chainhash.Hash, index uint32, tree int8, includeMempool bool) (*dcrdtypes.GetTxOutResult, error)
GetTxOut returns information about a transaction output as of the current mainchain tip of the underlying node.
NOTE: this returns a nil value with nil error if the output is not known or has already been spent.
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 []stdaddr.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 ¶
MempoolCount returns the count of a particular kind of transaction in mempool. Kind may be one of:
"all" "regular" "tickets" "votes" "revocations"
func (*RPC) MixMessage ¶
MixMessage queries the dcrd mixpool for a mixing message by its hash.
func (*RPC) MixPairRequests ¶
MixPairRequests returns all mixing pair request messages currently held by the dcrd mixpool.
func (*RPC) PublishMixMessages ¶
PublishMixMessages submits each mixing message to the dcrd mixpool for acceptance. If accepted, the messages are published to other peers.
func (*RPC) PublishTransaction ¶
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 ¶
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 ¶
StakeDifficulty returns the stake difficulty (AKA ticket price) of the next block.
func (*RPC) UsedAddresses ¶
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.