btcscanner

package
v0.6.0-rc0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BtcScanner

type BtcScanner struct {
	// connect to BTC node
	BtcClient btcclient.BTCClient

	// the BTC height the scanner starts
	BaseHeight uint64
	// the BTC confirmation depth
	K uint64

	ConfirmedBlocksChan chan *types.IndexedBlock

	// cache of a sequence of unconfirmed blocks
	UnconfirmedBlockCache *types.BTCCache

	Synced *atomic.Bool

	Started *atomic.Bool
	// contains filtered or unexported fields
}

func New

func New(monitorCfg *config.MonitorConfig, btcClient btcclient.BTCClient, btclightclientBaseHeight uint64, checkpointTag []byte) (*BtcScanner, error)

func (*BtcScanner) Bootstrap

func (bs *BtcScanner) Bootstrap()

Bootstrap syncs with BTC by getting the confirmed blocks and the caching the unconfirmed blocks

func (*BtcScanner) GetCheckpointsChan

func (bs *BtcScanner) GetCheckpointsChan() chan *types.CheckpointRecord

func (*BtcScanner) GetHeadersChan

func (bs *BtcScanner) GetHeadersChan() chan *wire.BlockHeader

func (*BtcScanner) Start

func (bs *BtcScanner) Start()

Start starts the scanning process from curBTCHeight to tipHeight

func (*BtcScanner) Stop

func (bs *BtcScanner) Stop()

type Scanner

type Scanner interface {
	Start()
	GetCheckpointsChan() chan *types.CheckpointRecord
	GetHeadersChan() chan *wire.BlockHeader
	Stop()
}

Jump to

Keyboard shortcuts

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