filter

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

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

	// FTDPOS indicates the TxFilter's Filter is a DPOS filter.
	FTDPOS
)

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(txs []*types.Transaction, 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(uint8) TxFilter) *Filter

func (*Filter) Add

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

func (*Filter) Clear

func (f *Filter) Clear()

func (*Filter) Filter

func (f *Filter) Filter() TxFilter

func (*Filter) IsLoaded

func (f *Filter) IsLoaded() bool

func (*Filter) Load

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

func (*Filter) MatchConfirmed

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

func (*Filter) MatchUnconfirmed

func (f *Filter) MatchUnconfirmed(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

	// MatchConfirmed returns if a confirmed (packed into a block) transaction
	// matches the filter.
	MatchConfirmed(tx *types.Transaction) bool

	// MatchUnconfirmed returns if a unconfirmed (not packed into a block yet)
	// transaction matches the filter.
	MatchUnconfirmed(tx *types.Transaction) bool
}

TxFilter indicates the methods a transaction filter should implement.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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