filter

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: MIT Imports: 6 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// FTBloom indicates the TxFilter's Filter is a bloom filter.
	FTBloom = iota

	// FTTxType indicates the TxFilter's Filter is a transaction type filter.
	FTTxType
)

Variables

This section is empty.

Functions

func CheckMerkleBlock

func CheckMerkleBlock(m msg.MerkleBlock) ([]*common.Uint256, error)

take in a merkle block, parse through it, and return txids indicated If there's any problem return an error. Checks self-consistency only. doing it with a stack instead of recursion. Because... OK I don't know why I'm just not in to recursion OK?

func NewMerkleBlock

func NewMerkleBlock(block *types.Block, filter *Filter) (*msg.MerkleBlock, []uint32)

NewMerkleBlock returns a new *MerkleBlock

Types

type Filter

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

func New

func New(newFilter func(filterType TxFilterType) TxFilter) *Filter

func (*Filter) Add

func (f *Filter) Add(data []byte) error

func (*Filter) Clear

func (f *Filter) Clear()

func (*Filter) IsLoaded

func (f *Filter) IsLoaded() bool

func (*Filter) Load

func (f *Filter) Load(filter *msg.TxFilterLoad) error

func (*Filter) Match

func (f *Filter) Match(tx *types.Transaction) bool

type TxFilter

type TxFilter interface {
	// Load loads the transaction filter.
	Load(filter []byte) error

	// Add adds new data into filter.
	Add(data []byte) error

	// Match returns if a transaction matches the filter.
	Match(tx *types.Transaction) bool
}

TxFilter indicates the methods a transaction filter should implement.

func NewTxTypeFilter

func NewTxTypeFilter() TxFilter

type TxFilterType

type TxFilterType uint8

func (TxFilterType) String

func (f TxFilterType) String() string

String returns the TxFilterType in human-readable form.

Jump to

Keyboard shortcuts

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