tbc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UtxoIndexHashKey = []byte("utxoindexhash") // last indexed utxo hash
	TxIndexHashKey   = []byte("txindexhash")   // last indexed tx hash
)

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
	PeersWanted             int
	PrometheusListenAddress string
	PprofListenAddress      string
	Seeds                   []string
}

func NewDefaultConfig

func NewDefaultConfig() *Config

type HashHeight added in v0.2.0

type HashHeight struct {
	Hash   chainhash.Hash
	Height uint64
}

func (HashHeight) String added in v0.2.0

func (h HashHeight) String() string

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) BlockHeaderBest added in v0.2.0

func (s *Server) BlockHeaderBest(ctx context.Context) (uint64, *wire.BlockHeader, error)

BlockHeaderBest returns the headers for the best known blocks.

func (*Server) BlockHeaderByHash

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

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. It would be good if it can be deleted.

func (*Server) DifficultyAtHash added in v0.2.0

func (s *Server) DifficultyAtHash(ctx context.Context, hash *chainhash.Hash) (*big.Int, error)

func (*Server) FeesAtHeight

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

func (*Server) RawBlockHeaderBest added in v0.2.0

func (s *Server) RawBlockHeaderBest(ctx context.Context) (uint64, api.ByteSlice, error)

RawBlockHeaderBest returns the raw header for the best known block. XXX should we return cumulative difficulty, hash?

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) SyncIndexersToHash added in v0.2.0

func (s *Server) SyncIndexersToHash(ctx context.Context, hash *chainhash.Hash) error

SyncIndexersToHash tries to move the various indexers to the supplied height (inclusive).

func (*Server) Synced

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

Synced returns true if all block headers, blocks and all indexes are caught up.

func (*Server) TxById

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

func (*Server) TxIndexHash added in v0.2.0

func (s *Server) TxIndexHash(ctx context.Context) (*HashHeight, error)

TxIndexHash returns the last hash that has been been Tx indexed.

func (*Server) TxIndexer

func (s *Server) TxIndexer(ctx context.Context, endHash *chainhash.Hash) error

func (*Server) UtxoIndexHash added in v0.2.0

func (s *Server) UtxoIndexHash(ctx context.Context) (*HashHeight, error)

UtxoIndexHash returns the last hash that has been been UTxO indexed.

func (*Server) UtxoIndexer

func (s *Server) UtxoIndexer(ctx context.Context, endHash *chainhash.Hash) 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
	BlockHeader HashHeight
	Utxo        HashHeight
	Tx          HashHeight
}

Jump to

Keyboard shortcuts

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