datasource

package
v0.0.0-...-ff061ea Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package datasource abstracts every read-only chain/drivechain data fetch that bitwindow + the orchestrator make from Bitcoin Core and the BIP300301 enforcer, behind a single interface. The current ("local") implementation is wired straight to those endpoints; a future PR adds a remote implementation plus wallet-type-based selection (electrum wallets, which run no local Core or enforcer, get their read data from a remote server instead).

Read-only only: writes/broadcast/signing and crypto primitives are NOT here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitcoindGetter

BitcoindGetter lazily resolves the Core Connect client.

type ChainReader

ChainReader is the read-only Bitcoin Core surface. It returns the btc-buf corepb messages bitwindow already consumes, so migrating a handler is a pure extraction (drop the service.Get + connect wrappers). A future remote impl serves the same messages.

type CoreSource

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

CoreSource implements ChainReader against the live Core Connect client.

func NewCoreSource

func NewCoreSource(bitcoind BitcoindGetter) *CoreSource

NewCoreSource builds the local Core-backed reader from a client getter.

func (*CoreSource) Block

func (*CoreSource) BlockHash

func (*CoreSource) EstimateSmartFee

func (*CoreSource) ListUnspent

func (*CoreSource) ListWalletTransactions

func (*CoreSource) ListWallets

func (c *CoreSource) ListWallets(ctx context.Context, req *emptypb.Empty) (*corepb.ListWalletsResponse, error)

func (*CoreSource) NetTotals

func (*CoreSource) NetworkInfo

func (*CoreSource) PeerInfo

func (*CoreSource) RawMempool

type DataSource

type DataSource interface {
	DrivechainReader
	EnforcerWalletReader
	ChainReader
}

DataSource is the full read-only surface: mainchain/enforcer reads plus Bitcoin Core chain reads. It is composed of segregated readers so callers can depend only on what they use, and so the Core reader (whose backing client differs between services) can be supplied independently.

type DrivechainReader

DrivechainReader is the read-only enforcer ValidatorService surface — chain tip/headers, sidechains, proposals, two-way-peg data. Returns the shared cusf.mainchain.v1 proto messages (both services already speak them), so the local impl is a thin unwrap of the Connect client.

type EnforcerSource

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

EnforcerSource implements DrivechainReader + EnforcerWalletReader against the live enforcer Connect clients. Shared by both services — they hold the same client types.

func NewEnforcerSource

func NewEnforcerSource(validator ValidatorGetter, wallet WalletGetter) *EnforcerSource

NewEnforcerSource builds the local enforcer-backed reader from client getters.

func (*EnforcerSource) Balance

func (*EnforcerSource) BlockHeaderInfo

func (*EnforcerSource) BlockInfo

func (*EnforcerSource) BmmHStarCommitment

func (*EnforcerSource) ChainInfo

func (*EnforcerSource) ChainTip

func (*EnforcerSource) Ctip

func (*EnforcerSource) ListTransactions

func (*EnforcerSource) ListUnspentOutputs

func (*EnforcerSource) SidechainProposals

func (*EnforcerSource) Sidechains

func (*EnforcerSource) TwoWayPegData

func (*EnforcerSource) WalletInfo

func (e *EnforcerSource) WalletInfo(ctx context.Context, req *v1.GetInfoRequest) (*v1.GetInfoResponse, error)

type EnforcerWalletReader

EnforcerWalletReader is the read-only enforcer WalletService surface.

type Local

type Local struct {
	*CoreSource
	*EnforcerSource
}

Local is the full DataSource backed by live Core + enforcer clients. Composes the Core and enforcer readers; this is what the getters return today.

func NewLocal

func NewLocal(bitcoind BitcoindGetter, validator ValidatorGetter, wallet WalletGetter) *Local

NewLocal builds the full local DataSource from the three client getters.

type ValidatorGetter

Getter lazily resolves a Connect client, mirroring bitwindow's service.Service[T].Get — we take a func rather than the concrete type so the datasource package (in the orchestrator module) doesn't import bitwindow.

Jump to

Keyboard shortcuts

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