predict

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: 6 Imported by: 0

Documentation

Overview

Package predict contains routines for validating the sim models, by predicting the confirmation times of transactions and comparing with the observed confirmation times.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxBlockConfirms int `yaml:"maxblockconfirms" json:"maxblockconfirms"`
	Halflife         int `yaml:"halflife" json:"halflife"` // In number of blocks

	Logger *log.Logger `yaml:"-" json:"-"`
}

type DB

type DB interface {
	// The returned map must only contain those txids which were previously Put.
	GetTxs(txids []string) (map[string]Tx, error)

	PutTxs(txs map[string]Tx) error

	GetScores() (attained, exceeded []float64, err error)
	PutScores(attained, exceeded []float64) error

	Reconcile(txids []string) error
	Close() error
}

type Predictor

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

TODO: Consider tallying predicts once the block heights exceeds confirmBy

func NewPredictor

func NewPredictor(db DB, cfg Config) (*Predictor, error)

func (*Predictor) AddPredicts

func (p *Predictor) AddPredicts(s *col.MempoolState, simResult []sim.FeeRate) error

func (*Predictor) Cleanup

func (p *Predictor) Cleanup(s *col.MempoolState) error

func (*Predictor) GetScores

func (p *Predictor) GetScores() (attained []float64, exceeded []float64, err error)

func (*Predictor) ProcessBlock

func (p *Predictor) ProcessBlock(b col.Block) error

type Tx

type Tx struct {
	ConfirmIn int64
	ConfirmBy int64
}

Jump to

Keyboard shortcuts

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