collect

package
v0.0.0-...-242325e Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package collect contains routines for collecting data from the Bitcoin network, which is then used by package estimate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PruneLowFee

func PruneLowFee(entries map[string]MempoolEntry, thresh sim.FeeRate)

Remove mempool entries with a feerate lower than thresh, along with its descendants.

func SimifyMempool

func SimifyMempool(entries map[string]MempoolEntry) ([]*sim.Tx, error)

SimifyMempool converts the mempool data in mempoolState into the form expected by Sim. We check here that the mempool is closed; i.e. that all parents listed in a tx's "depends" field are also in the mempool.

Types

type Block

type Block interface {
	Height() int64
	Size() int64
	Txids() []string
	NumHashes() float64
}

type BlockGetter

type BlockGetter func(height int64) (Block, error)

type BlockStatDB

type BlockStatDB interface {
	Put([]*est.BlockStat) error
}

type Collector

type Collector struct {
	S <-chan *MempoolState
	B <-chan []Block
	E <-chan error
	// contains filtered or unexported fields
}

NOTE: S,B,E channels must be serviced.

func NewCollector

func NewCollector(tdb TxDB, bdb BlockStatDB, cfg Config) *Collector

func (*Collector) Run

func (c *Collector) Run() error

func (*Collector) State

func (c *Collector) State() *MempoolState

NOTE: state can be nil, if getState returns errors.

func (*Collector) Stop

func (c *Collector) Stop()

type Config

type Config struct {
	PollPeriod int `yaml:"pollperiod" json:"pollperiod"`

	GetState MempoolStateGetter `yaml:"-" json:"-"`
	GetBlock BlockGetter        `yaml:"-" json:"-"`
	Logger   *log.Logger        `yaml:"-" json:"-"`
}

type MempoolEntry

type MempoolEntry interface {
	Size() sim.TxSize
	FeeRate() sim.FeeRate
	Time() int64
	Depends() []string
	IsHighPriority() bool
}

type MempoolState

type MempoolState struct {
	Height     int64                   `json:"height"`
	Entries    map[string]MempoolEntry `json:"entries"`
	Time       int64                   `json:"time"`
	MinFeeRate sim.FeeRate             `json:"minfeerate"`
}

func (*MempoolState) Copy

func (s *MempoolState) Copy() *MempoolState

func (*MempoolState) SizeFn

func (s *MempoolState) SizeFn() sim.MonotonicFn

func (*MempoolState) String

func (s *MempoolState) String() string

func (*MempoolState) Sub

type MempoolStateDiff

type MempoolStateDiff struct {
	Height  int64
	Entries map[string]MempoolEntry
	Time    int64
}

type MempoolStateGetter

type MempoolStateGetter func() (*MempoolState, error)

type TxDB

type TxDB interface {
	Put([]est.Tx) error
}

Directories

Path Synopsis
Package corerpc implements the data collection abstractions in package collect by using the Bitcoin Core JSON-RPC API.
Package corerpc implements the data collection abstractions in package collect by using the Bitcoin Core JSON-RPC API.

Jump to

Keyboard shortcuts

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