coredb

package
v0.0.0-...-f87342c Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BLOCK_VALID_HEADER       = 1
	BLOCK_VALID_TREE         = 2
	BLOCK_VALID_TRANSACTIONS = 3
	BLOCK_VALID_CHAIN        = 4
	BLOCK_VALID_SCRIPTS      = 5
	BLOCK_VALID_MASK         = BLOCK_VALID_HEADER | BLOCK_VALID_TREE | BLOCK_VALID_TRANSACTIONS | BLOCK_VALID_CHAIN | BLOCK_VALID_SCRIPTS
	BLOCK_HAVE_DATA          = 8
	BLOCK_HAVE_UNDO          = 16
	BLOCK_HAVE_MASK          = BLOCK_HAVE_DATA | BLOCK_HAVE_UNDO
	BLOCK_FAILED_VALID       = 32
	BLOCK_FAILED_CHILD       = 64
	BLOCK_FAILED_MASK        = BLOCK_FAILED_VALID | BLOCK_FAILED_CHILD
	BLOCK_OPT_WITNESS        = 128
)

https://github.com/bitcoin/bitcoin/blob/0.15/src/chain.h#L125

Variables

This section is empty.

Functions

func ReadLevelDbBlockHeaderIndex

func ReadLevelDbBlockHeaderIndex(path, blocksPath string, magic uint32, startHeight int) (blkchain.BlockHeaderIndex, error)

Returns a levelDbBlockHeaderIndex over which we can iterate with Next(). Some heights have multiple blocks. This func removes orphans (TODO - why do we, it caused a problem with marking spends, but that should be no longer an issue since we import UTXO set separately?) Core cannot be running during this (TODO why?), but as soon as it is done you should be able to start it back up.

Types

type ChainStateReader

type ChainStateReader struct {
	*leveldb.DB
	iterator.Iterator
}

func NewChainStateChecker

func NewChainStateChecker(path string) (*ChainStateReader, error)

func NewChainStateIterator

func NewChainStateIterator(path string) (*ChainStateReader, error)

TODO unused

func (*ChainStateReader) GetUTXO

func (r *ChainStateReader) GetUTXO() (*UTXO, error)

TODO unused

func (*ChainStateReader) IsUTXO

func (r *ChainStateReader) IsUTXO(hash blkchain.Uint256, n uint32) (bool, error)

type DbOutPoint

type DbOutPoint blkchain.OutPoint

An OutPoint which uses a varint for N such as the case in chainstate LevelDb keys

func (*DbOutPoint) BinRead

func (o *DbOutPoint) BinRead(r io.Reader) error

func (*DbOutPoint) BinWrite

func (o *DbOutPoint) BinWrite(w io.Writer) error

type UTXO

type UTXO struct {
	DbOutPoint
	Height   int
	Coinbase bool
	blkchain.TxOut
}

func (*UTXO) BinRead

func (u *UTXO) BinRead(r io.Reader) (err error)

Note that the OutPoint is not read here

type VarInt32

type VarInt32 uint32

func (*VarInt32) BinRead

func (v *VarInt32) BinRead(r io.Reader) error

Jump to

Keyboard shortcuts

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