tbc

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UtxoIndexHeightKey = []byte("utxoindexheight") // last indexed utxo height key
	TxIndexHeightKey   = []byte("txindexheight")   // last indexed tx height key
)

Functions

func NewPeer

func NewPeer(network wire.BitcoinNet, address string) (*peer, error)

Types

type Config

type Config struct {
	AutoIndex               bool
	BlockSanity             bool
	LevelDBHome             string
	ListenAddress           string
	LogLevel                string
	MaxCachedTxs            int
	Network                 string
	PrometheusListenAddress string
	PprofListenAddress      string
}

func NewDefaultConfig

func NewDefaultConfig() *Config

type Server

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

func NewServer

func NewServer(cfg *Config) (*Server, error)

func (*Server) BalanceByAddress

func (s *Server) BalanceByAddress(ctx context.Context, encodedAddress string) (uint64, error)

func (*Server) BlockHeaderByHash

func (s *Server) BlockHeaderByHash(ctx context.Context, hash *chainhash.Hash) (*wire.BlockHeader, uint64, error)

func (*Server) BlockHeadersBest

func (s *Server) BlockHeadersBest(ctx context.Context) (uint64, []*wire.BlockHeader, error)

BlockHeadersBest returns the headers for the best known blocks.

func (*Server) BlockHeadersByHeight

func (s *Server) BlockHeadersByHeight(ctx context.Context, height uint64) ([]*wire.BlockHeader, error)

func (*Server) DB

func (s *Server) DB() tbcd.Database

DB exports the underlying database. This should only be used in tests.

func (*Server) DBClose

func (s *Server) DBClose() error

func (*Server) DBOpen

func (s *Server) DBOpen(ctx context.Context) error

DBOpen opens the underlying server database. It has been put in its own function to make it available during tests and hemictl.

func (*Server) FeesAtHeight

func (s *Server) FeesAtHeight(ctx context.Context, height, count int64) (uint64, error)

func (*Server) RawBlockHeadersBest

func (s *Server) RawBlockHeadersBest(ctx context.Context) (uint64, []api.ByteSlice, error)

RawBlockHeadersBest returns the raw headers for the best known blocks.

func (*Server) RawBlockHeadersByHeight

func (s *Server) RawBlockHeadersByHeight(ctx context.Context, height uint64) ([]api.ByteSlice, error)

func (*Server) Run

func (s *Server) Run(pctx context.Context) error

func (*Server) SyncIndexersToHeight

func (s *Server) SyncIndexersToHeight(ctx context.Context, height uint64) error

SyncIndexersToHeight tries to move the various indexers to the suplied height (inclusive).

func (*Server) Synced

func (s *Server) Synced(ctx context.Context) (si SyncInfo)

func (*Server) TxById

func (s *Server) TxById(ctx context.Context, txId tbcd.TxId) (*wire.MsgTx, error)

func (*Server) TxIndexer

func (s *Server) TxIndexer(ctx context.Context, height, count uint64) error

TxIndexer starts indexing at start height for count blocks. If count is 0 the indexers will index to tip. It does NOT verify that the provided start height is correct. This is the version of the function that has no training wheels and is meant for internal use only.

func (*Server) UtxoIndexer

func (s *Server) UtxoIndexer(ctx context.Context, height, count uint64) error

func (*Server) UtxosByAddress

func (s *Server) UtxosByAddress(ctx context.Context, encodedAddress string, start uint64, count uint64) ([]tbcd.Utxo, error)

type SyncInfo

type SyncInfo struct {
	Synced            bool   // True when all indexing is caught up
	BlockHeaderHeight uint64 // last block header height
	UtxoHeight        uint64 // last indexed utxo block height
	TxHeight          uint64 // last indexed tx block height
}

Jump to

Keyboard shortcuts

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