Documentation
¶
Index ¶
- Variables
- type Bus
- func (b *Bus) Close()
- func (b *Bus) DeriveAddress(descriptor string, index int) (*string, error)
- func (b *Bus) EstimateSmartFee(target int64, mode string) btcutil.Amount
- func (b *Bus) FlushCache()
- func (b *Bus) GetAddressInfo(address string) (*btcjson.GetAddressInfoResult, error)
- func (b *Bus) GetBestBlockHash() (*chainhash.Hash, error)
- func (b *Bus) GetBlock(hash *chainhash.Hash) (*types.Block, error)
- func (b *Bus) GetBlockChainInfo() (*btcjson.GetBlockChainInfoResult, error)
- func (b *Bus) GetBlockHash(height int64) (*chainhash.Hash, error)
- func (b *Bus) GetCanonicalDescriptor(descriptor string) (*string, error)
- func (b *Bus) GetTransaction(hash *chainhash.Hash) (*btcjson.TxRawResult, error)
- func (b *Bus) GetWalletInfo() (*btcjson.GetWalletInfoResult, error)
- func (b *Bus) ImportAccounts(accounts []config.Account) error
- func (b *Bus) ImportDescriptors(descriptors []descriptor) error
- func (b *Bus) ListTransactions(blockHash *string) ([]btcjson.ListTransactionsResult, error)
- func (b *Bus) NewCache()
- func (b *Bus) RunTheNumbers() error
- func (b *Bus) SendTransaction(tx string) (*chainhash.Hash, error)
- func (b *Bus) WaitForNodeSync() error
- type Currency
- type ExplorerStatus
- type Status
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBitcoindUnreachable indicates that an RPC call to the bitcoind node // was not successful. Use this error during sanity checks. ErrBitcoindUnreachable = errors.New("bitcoind unreachable") // ErrWalletDisabled indicates that wallet features have been disabled on // the connected Bitcoin node. SatStack relies on wallet RPCs to function. ErrWalletDisabled = errors.New("bitcoind wallet is disabled") // ErrCreateWallet indicates that the wallet RPC createwallet was not // successful. ErrCreateWallet = errors.New("failed to create wallet") // ErrLoadWallet indicates that the wallet RPC loadwallet was not // successful. ErrLoadWallet = errors.New("failed to load wallet") // ErrUnsupportedBitcoindVersion indicates that the connected bitcoind node // has a version that is not supported by SatStack. ErrUnsupportedBitcoindVersion = errors.New("unsupported bitcoind version") // ErrUnrecognizedChain indicates that the Chain returned by bitcoind in // its response to the getblockchaininfo RPC, is unrecognized by LSS. // // This usually means that the value doesn't correspond to a Currency or // network that libcore can understand. ErrUnrecognizedChain = errors.New("unrecognized chain") // ErrFailedToGetBlock indicates that an error was encountered while // trying to get a block. ErrFailedToGetBlock = errors.New("failed to get block") // ErrMalformedChainHash indicates that a chain hash (transaction or block) // could not be parsed. ErrMalformedChainHash = errors.New("malformed chain hash") // ErrFailedToDetectTxIndex indicates an irrecoverable error while trying // to detect presence of a transaction index. Normally, this error should // not be ignored silently. ErrFailedToDetectTxIndex = errors.New("failed to detect txindex") // ErrFailedToDetectBlockFilter indicates an irrecoverable error while trying // to detect presence of a compact block filter index. Normally, this error // should not be ignored silently. ErrFailedToDetectBlockFilter = errors.New("failed to detect block filter") // ErrInvalidDescriptor indicates that a malformed descriptor was // encountered. ErrInvalidDescriptor = errors.New("invalid descriptor") // ErrDeriveAddress indicates that an address could not be derived from a // descriptor. ErrDeriveAddress = errors.New("failed to derive address") // ErrAddressInfo indicates that an error was encountered while trying to // fetch address info. ErrAddressInfo = errors.New("failed to get address info") )
Functions ¶
This section is empty.
Types ¶
type Bus ¶
type Bus struct { // Informational fields Chain string Pruned bool TxIndex bool BlockFilter bool Currency Currency // Based on Chain value, for interoperability with libcore Status Status // Thread-safe Bus cache, to query results typically by hash Cache *cache.Cache // contains filtered or unexported fields }
Bus represents a transport allowing access to Bitcoin RPC methods.
It maintains a pool of btcd rpcclient objects in a buffered channel to allow concurrent invocation of RPC methods.
func (*Bus) Close ¶
func (b *Bus) Close()
Close performs cleanup operations on the Bus, notably shutting down the rpcclient connections.
func (*Bus) DeriveAddress ¶
func (*Bus) EstimateSmartFee ¶
func (*Bus) FlushCache ¶
func (b *Bus) FlushCache()
FlushCache clears the Bus cache storage, and sets the value of Bus.Cache to nil.
func (*Bus) GetAddressInfo ¶
func (b *Bus) GetAddressInfo(address string) (*btcjson.GetAddressInfoResult, error)
func (*Bus) GetBlockChainInfo ¶
func (b *Bus) GetBlockChainInfo() (*btcjson.GetBlockChainInfoResult, error)
func (*Bus) GetCanonicalDescriptor ¶
GetCanonicalDescriptor returns the descriptor in canonical form, along with its computed checksum.
func (*Bus) GetTransaction ¶
func (*Bus) GetWalletInfo ¶
func (b *Bus) GetWalletInfo() (*btcjson.GetWalletInfoResult, error)
func (*Bus) ImportAccounts ¶
ImportAccounts will import the descriptors corresponding to the accounts into the Bitcoin Core wallet. This is a blocking operation.
func (*Bus) ImportDescriptors ¶
func (*Bus) ListTransactions ¶
func (b *Bus) ListTransactions(blockHash *string) ([]btcjson.ListTransactionsResult, error)
func (*Bus) NewCache ¶
func (b *Bus) NewCache()
NewCache initializes a new cache storage and assigns it to the Cache field of Bus.
func (*Bus) RunTheNumbers ¶
RunTheNumbers performs inflation checks against the connected full node.
It does NOT perform any equality comparison between expected and actual supply.
func (*Bus) WaitForNodeSync ¶
type Currency ¶
type Currency = string
Currency represents the currency type (btc) and the network params (Mainnet, testnet3, regtest, etc) in libcore parlance.
func CurrencyFromChain ¶
currencyFromChain is an adapter function to convert a chain (network) value to a Currency type that's understood by libcore.
type ExplorerStatus ¶
type ExplorerStatus struct { TxIndex bool `json:"txindex"` BlockFilter bool `json:"block_filter"` Pruned bool `json:"pruned"` Chain string `json:"chain"` Currency Currency `json:"currency"` Status Status `json:"status"` SyncProgress *float64 `json:"sync_progress,omitempty"` ScanProgress *float64 `json:"scan_progress,omitempty"` }
ExplorerStatus represents the structure of payload returned by GetStatus service method.
type Status ¶
type Status string
Status indicates the state of LSS with regards to the readiness of the connected Bitcoin Core node.
const ( // Initializing is a Status to indicate the initial state of LSS, while it // is warming up. This is typically the case when LSS is launched, until // any new Status is assigned. Initializing Status = "initializing" // Ready is a Status to indicate that LSS is ready to accept explorer API // requests from Ledger Live. Ready Status = "ready" // Syncing is a Status to indicate that the Bitcoin Core node is currently // downloading and validating blocks. Syncing Status = "syncing" // PendingScan is a Status to indicate that the Bitcoin Core node has // finished syncing, and is ready to import account descriptors into its // wallet. PendingScan Status = "pending_scan" // Scanning is a Status to indicate that the Bitcoin Core node is currently // importing account descriptors into its wallet. Scanning Status = "scanning" )