chain

package
v0.0.0-...-f296bfa Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NeutrinoClient

type NeutrinoClient struct {
	CS *neutrino.ChainService
	// contains filtered or unexported fields
}

NeutrinoClient is an implementation of the bchwalet chain.Interface interface.

func NewNeutrinoClient

func NewNeutrinoClient(chainParams *chaincfg.Params,
	chainService *neutrino.ChainService, log bchlog.Logger) *NeutrinoClient

NewNeutrinoClient creates a new NeutrinoClient struct with a backing ChainService.

func (*NeutrinoClient) BackEnd

func (s *NeutrinoClient) BackEnd() string

BackEnd returns the name of the driver.

func (*NeutrinoClient) BlockStamp

func (s *NeutrinoClient) BlockStamp() (*waddrmgr.BlockStamp, error)

BlockStamp returns the latest block notified by the client, or an error if the client has been shut down.

func (*NeutrinoClient) FilterBlocks

FilterBlocks scans the blocks contained in the FilterBlocksRequest for any addresses of interest. For each requested block, the corresponding compact filter will first be checked for matches, skipping those that do not report anything. If the filter returns a postive match, the full block will be fetched and filtered. This method returns a FilterBlocksReponse for the first block containing a matching address. If no matches are found in the range of blocks requested, the returned response will be nil.

func (*NeutrinoClient) GetBestBlock

func (s *NeutrinoClient) GetBestBlock() (*chainhash.Hash, int32, error)

GetBestBlock replicates the RPC client's GetBestBlock command.

func (*NeutrinoClient) GetBlock

func (s *NeutrinoClient) GetBlock(hash *chainhash.Hash) (*wire.MsgBlock, error)

GetBlock replicates the RPC client's GetBlock command.

func (*NeutrinoClient) GetBlockHash

func (s *NeutrinoClient) GetBlockHash(height int64) (*chainhash.Hash, error)

GetBlockHash returns the block hash for the given height, or an error if the client has been shut down or the hash at the block height doesn't exist or is unknown.

func (*NeutrinoClient) GetBlockHeader

func (s *NeutrinoClient) GetBlockHeader(
	blockHash *chainhash.Hash) (*wire.BlockHeader, error)

GetBlockHeader returns the block header for the given block hash, or an error if the client has been shut down or the hash doesn't exist or is unknown.

func (*NeutrinoClient) GetBlockHeight

func (s *NeutrinoClient) GetBlockHeight(hash *chainhash.Hash) (int32, error)

GetBlockHeight gets the height of a block by its hash. It serves as a replacement for the use of GetBlockVerboseTxAsync for the wallet package since we can't actually return a FutureGetBlockVerboseResult because the underlying type is private to rpcclient.

func (*NeutrinoClient) IsCurrent

func (s *NeutrinoClient) IsCurrent() bool

IsCurrent returns whether the chain backend considers its view of the network as "current".

func (*NeutrinoClient) Notifications

func (s *NeutrinoClient) Notifications() <-chan interface{}

Notifications replicates the RPC client's Notifications method.

func (*NeutrinoClient) NotifyBlocks

func (s *NeutrinoClient) NotifyBlocks() error

NotifyBlocks replicates the RPC client's NotifyBlocks command.

func (*NeutrinoClient) NotifyReceived

func (s *NeutrinoClient) NotifyReceived(addrs []bchutil.Address) error

NotifyReceived replicates the RPC client's NotifyReceived command.

func (*NeutrinoClient) Rescan

func (s *NeutrinoClient) Rescan(startHash *chainhash.Hash, addrs []bchutil.Address,
	outPoints map[wire.OutPoint]bchutil.Address) error

Rescan replicates the RPC client's Rescan command.

func (*NeutrinoClient) SendRawTransaction

func (s *NeutrinoClient) SendRawTransaction(tx *wire.MsgTx, allowHighFees bool) (
	*chainhash.Hash, error)

SendRawTransaction replicates the RPC client's SendRawTransaction command.

func (*NeutrinoClient) SetStartTime

func (s *NeutrinoClient) SetStartTime(startTime time.Time)

SetStartTime is a non-interface method to set the birthday of the wallet using this object. Since only a single rescan at a time is currently supported, only one birthday needs to be set. This does not fully restart a running rescan, so should not be used to update a rescan while it is running. TODO: When factoring out to multiple rescans per Neutrino client, add a birthday per client.

func (*NeutrinoClient) Start

func (s *NeutrinoClient) Start() error

Start replicates the RPC client's Start method.

func (*NeutrinoClient) Stop

func (s *NeutrinoClient) Stop()

Stop replicates the RPC client's Stop method.

func (*NeutrinoClient) WaitForShutdown

func (s *NeutrinoClient) WaitForShutdown()

WaitForShutdown replicates the RPC client's WaitForShutdown method.

Jump to

Keyboard shortcuts

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