headers

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BKTHeaders  = []byte("H")
	BKTChainTip = []byte("B")
)

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func UseLogger

func UseLogger(logger elalog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using elalog.

Types

type Database

type Database struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

Headers implements Headers using bolt DB

func NewDatabase

func NewDatabase(dataDir string) (*Database, error)

func (*Database) Clear

func (d *Database) Clear() error

func (*Database) Close

func (d *Database) Close() error

Close db

func (*Database) Get

func (d *Database) Get(hash *common.Uint256) (header *util.Header, err error)

func (*Database) GetBest

func (d *Database) GetBest() (header *util.Header, err error)

func (*Database) GetPrevious

func (d *Database) GetPrevious(header *util.Header) (*util.Header, error)

func (*Database) Put

func (d *Database) Put(header *util.Header, newTip bool) error

Jump to

Keyboard shortcuts

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