bch

package
v0.0.0-...-e16fa07 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DustLimit = 546

Variables

This section is empty.

Functions

This section is empty.

Types

type Bch

type Bch struct {
	Nodes *Nodes
	// contains filtered or unexported fields
}

func NewBch

func NewBch(ctx context.Context, logger log.Logger) (*Bch, error)

func (*Bch) GetBestAddress

func (b *Bch) GetBestAddress() string

func (*Bch) GetTransaction

func (b *Bch) GetTransaction(ctx context.Context, txHash string) (*electrum.GetTransactionResult, error)

func (*Bch) ListUnspent

func (b *Bch) ListUnspent(ctx context.Context, newAddress string) ([]*electrum.ListUnspentResult, error)

func (*Bch) StartNodeTimer

func (b *Bch) StartNodeTimer()

StartNodeTimer pulls data from nodes.

func (*Bch) WatchNewBlocks

func (b *Bch) WatchNewBlocks(ctx context.Context) (<-chan *bitcoin.BlockHeaderAndCoinbase, error)

WatchNewBlocks is a blocking call to wait for new block headers.

type BestBlockHeight

type BestBlockHeight struct {
	BlockNumber uint32    `json:"block_number"`
	BlockTime   time.Time `json:"block_time"`
	Received    time.Time `json:"received"` // when WE saw this node got this block
}

type Node

type Node struct {
	// config
	Address  string `mapstructure:"Address"`
	User     string `mapstructure:"User"`
	Password string `mapstructure:"Password"`
	SSL      bool   `mapstructure:"SSL"`

	Fulcrum        string `mapstructure:"Fulcrum"`
	FulcrumPingMin int    `mapstructure:"FulcrumPingMin"`
	// contains filtered or unexported fields
}

func (*Node) GetBchClient

func (n *Node) GetBchClient() *bitcoin.Bitcoind

func (*Node) GetElectrumClient

func (n *Node) GetElectrumClient() *electrum.Client

func (*Node) SetBlockHeight

func (n *Node) SetBlockHeight(blockHeight uint32, timestamp time.Time)

func (*Node) SetConnected

func (n *Node) SetConnected()

type NodeConnectError

type NodeConnectError struct {
	When  time.Time `json:"when"`
	Error error     `json:"error"`
}

type NodeStats

type NodeStats struct {
	Connected       time.Time           `json:"connected"`
	BlockHeight     BestBlockHeight     `json:"block_height"`
	LostConnections []*NodeConnectError `json:"lost_connections"`
	LastNotified    time.Time           `json:"last_notified"`
}

Node stats available via HTTP API as JSON

type Nodes

type Nodes struct {
	Nodes []*Node
}

func (*Nodes) GetBestBlockNode

func (nodes *Nodes) GetBestBlockNode() *Node

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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