utxo

package
v1.123.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: MIT Imports: 55 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// TODO: remove since Thornode enforces limit in response.
	MaxAsgardAddresses = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client defines a generic UTXO client. Since there are differences in addresses, RPCs, and txscript between chains, chain additions should audit switches on chain type and extend where appropriate.

func NewClient

NewClient generates a new Client

func (*Client) BroadcastTx

func (c *Client) BroadcastTx(txOut stypes.TxOutItem, payload []byte) (string, error)

BroadcastTx will broadcast the given payload.

func (*Client) ConfirmationCountReady

func (c *Client) ConfirmationCountReady(txIn types.TxIn) bool

ConfirmationCountReady will be called by the observer before sending the txIn to Thorchain. It will return true if the scanner height is greater than or equal to the observed block height + confirmation required. https://medium.com/coinmonks/1confvalue-a-simple-pow-confirmation-rule-of-thumb-a8d9c6c483dd

func (*Client) FetchMemPool

func (c *Client) FetchMemPool(height int64) (types.TxIn, error)

FetchMemPool retrieves txs from mempool

func (*Client) FetchTxs

func (c *Client) FetchTxs(height, chainHeight int64) (types.TxIn, error)

FetchTxs retrieves txs for a block height. The first argument is the block height to fetch, the second argument is the currnet chain tip.

func (*Client) GetAccount

func (c *Client) GetAccount(pubkey common.PubKey, height *big.Int) (common.Account, error)

GetAccount returns the account details for the given public key.

func (*Client) GetAccountByAddress

func (c *Client) GetAccountByAddress(address string, height *big.Int) (common.Account, error)

GetAccountByAddress is unimplemented for UTXO chains.

func (*Client) GetAddress

func (c *Client) GetAddress(pubkey common.PubKey) string

GetAddress returns chain address for the given public key.

func (*Client) GetChain

func (c *Client) GetChain() common.Chain

GetChain returns the chain ID.

func (*Client) GetConfig

func (c *Client) GetConfig() config.BifrostChainConfiguration

GetConfig returns the chain configuration.

func (*Client) GetConfirmationCount

func (c *Client) GetConfirmationCount(txIn types.TxIn) int64

GetConfirmationCount returns the number of blocks required before processing in Thorchain.

func (*Client) GetHeight

func (c *Client) GetHeight() (int64, error)

GetHeight returns current chain (not scanner) height.

func (*Client) IsBlockScannerHealthy

func (c *Client) IsBlockScannerHealthy() bool

IsBlockScannerHealthy returns true if the block scanner is healthy.

func (*Client) OnObservedTxIn

func (c *Client) OnObservedTxIn(txIn types.TxInItem, blockHeight int64)

OnObservedTxIn is called by the observer when a transaction is observed.

func (*Client) RegisterPublicKey

func (c *Client) RegisterPublicKey(pubkey common.PubKey) error

RegisterPublicKey imports the provided public key in the chain daemon.

func (*Client) ReportSolvency

func (c *Client) ReportSolvency(height int64) error

ReportSolvency reports solvency for all asgard vaults.

func (*Client) ShouldReportSolvency

func (c *Client) ShouldReportSolvency(height int64) bool

ShouldReportSolvency returns true if solvency should be reported at the given height.

func (*Client) SignTx

func (c *Client) SignTx(tx stypes.TxOutItem, thorchainHeight int64) ([]byte, []byte, *stypes.TxInItem, error)

SignTx builds and signs the outbound transaction. Returns the signed transaction, a serialized checkpoint on error, and an error.

func (*Client) Start

func (c *Client) Start(
	globalTxsQueue chan types.TxIn,
	globalErrataQueue chan types.ErrataBlock,
	globalSolvencyQueue chan types.Solvency,
)

Start starts the scanner, signer, and solvency check.

func (*Client) Stop

func (c *Client) Stop()

Stop stops the scanner, signer, and solvency check.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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