scanner

package
v0.0.0-...-0928cd4 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const MaxCacheSize = 100_000

Variables

This section is empty.

Functions

This section is empty.

Types

type BchScanner

type BchScanner struct {
	Client bch.IBchClient
	Store  store.IStore

	MaxTxsInBlock    int
	OriginChainParam *chaincfg.Params

	LatestScanBlockHeight int64
	// contains filtered or unexported fields
}

func NewBchScanner

func NewBchScanner(store store.IStore, mainChainClientInfo string, maxTxsInBlock int, logger log.Logger) *BchScanner

func (*BchScanner) AddKnownTx

func (b *BchScanner) AddKnownTx(txHash string)

func (*BchScanner) GetConfirmations

func (b *BchScanner) GetConfirmations(txHash [32]byte) int32

Getconfirmations return value: when tx mined in virtual chain, its finalize number is 0, when it mined in source chain the latest block, its finalize number is 1, when it not is mined by source chain and is not in mempool either, we think one or more of its inputs have been spent by other tx, so its finalize number is -1.

func (*BchScanner) GetLatestScanHeight

func (b *BchScanner) GetLatestScanHeight() int64

func (*BchScanner) GetNewTxs

func (b *BchScanner) GetNewTxs(blockHeight int64, blockHash [32]byte, scanBlock bool) []modbtypes.Tx

func (*BchScanner) SetLatestScanHeight

func (b *BchScanner) SetLatestScanHeight(blockHeight int64)

type IScanner

type IScanner interface {
	GetNewTxs(blockHeight int64, blockHash [32]byte, scanBlock bool) []modbtypes.Tx
	GetConfirmations(txHash [32]byte) int32
	SetLatestScanHeight(blockHeight int64)
	GetLatestScanHeight() int64
}

type MockStore

type MockStore struct {
	// contains filtered or unexported fields
}

func (*MockStore) AddBlock

func (m *MockStore) AddBlock(blk *modbtypes.Block)

func (MockStore) Close

func (m MockStore) Close()

func (*MockStore) GetBlockByHash

func (m *MockStore) GetBlockByHash(blkHash [32]byte) (blk *types.Block, err error)

func (*MockStore) GetBlockByHeight

func (m *MockStore) GetBlockByHeight(height uint64) (*types.Block, error)

func (*MockStore) GetLatestBlockInfo

func (m *MockStore) GetLatestBlockInfo() (height, timestamp int64, hash [32]byte, latestScanBlockHeight int64)

func (*MockStore) GetTxByHash

func (m *MockStore) GetTxByHash(txHash common.Hash) (tx *types.Transaction, sig [65]byte, err error)

func (MockStore) GetTxListByHeightWithRange

func (m MockStore) GetTxListByHeightWithRange(height uint32, start, end int) (txs []*types.Transaction, sigs [][65]byte, err error)

func (*MockStore) IsTxMined

func (m *MockStore) IsTxMined(txHash string) bool

func (MockStore) QueryLogs

func (m MockStore) QueryLogs(addresses []common.Address, topics [][]common.Hash, startHeight, endHeight uint32, filter types.FilterFunc) (logs []types.Log, err error)

Jump to

Keyboard shortcuts

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