Documentation
¶
Index ¶
- Variables
- func RetryDo(logger zerolog.Logger, sleep time.Duration, maxSleepDuration time.Duration, ...) error
- type Chunk
- type ErrorCategory
- type Relayer
- func (r *Relayer) FindFirstUnknownHeaderIndex(ctx context.Context, indexedBlocks []*types.IndexedBlock) (int, error)
- func (r *Relayer) ProcessHeaders(ctx context.Context, indexedBlocks []*types.IndexedBlock) (int, error)
- func (r *Relayer) Start()
- func (r *Relayer) Stop()
- func (r *Relayer) UploadToWalrus(msgBlock *wire.MsgBlock, blockHeight int64, blockHashStr string)
- func (r *Relayer) WaitForShutdown()
- type WalrusHandler
Constants ¶
This section is empty.
Variables ¶
var ErrRetryTimeout = errors.New("retry timed out after maximum duration")
ErrRetryTimeout indicates that the operation failed after all retry attempts.
Functions ¶
Types ¶
type Chunk ¶
type Chunk struct { Headers []wire.BlockHeader From int64 To int64 }
Chunk represents a batch of block headers to be sent to the light client.
type Relayer ¶
type Relayer struct { // Configuration Config *config.RelayerConfig // contains filtered or unexported fields }
Relayer manages the Bitcoin SPV relayer functionality
func New ¶
func New( cfg *config.RelayerConfig, parentLogger zerolog.Logger, btcClient clients.BTCClient, lcClient clients.BitcoinSPV, walrusHandler *WalrusHandler, btcIndexer btcindexer.Indexer, ) (*Relayer, error)
New creates and returns a new relayer object
func (*Relayer) FindFirstUnknownHeaderIndex ¶
func (r *Relayer) FindFirstUnknownHeaderIndex(ctx context.Context, indexedBlocks []*types.IndexedBlock) (int, error)
FindFirstUnknownHeaderIndex finds the index of the first header not present in the light client.
func (*Relayer) ProcessHeaders ¶
func (r *Relayer) ProcessHeaders(ctx context.Context, indexedBlocks []*types.IndexedBlock) (int, error)
ProcessHeaders takes a list of blocks, extracts their headers and submits them to the light client. Returns the count of unique headers that were submitted.
func (*Relayer) Start ¶
func (r *Relayer) Start()
Start initializes and launches the SPV relayer goroutines for Bitcoin header verification and relay
func (*Relayer) Stop ¶
func (r *Relayer) Stop()
Stop signals all spv relayer goroutines to shutdown. if already stopped, this is a no-op.
func (*Relayer) UploadToWalrus ¶
UploadToWalrus upload full BTC block to Walrus
func (*Relayer) WaitForShutdown ¶
func (r *Relayer) WaitForShutdown()
WaitForShutdown waits for all relayer goroutines to complete before returning
type WalrusHandler ¶
type WalrusHandler struct {
// contains filtered or unexported fields
}
WalrusHandler wraps the Walrus client
func NewWalrusHandler ¶
func NewWalrusHandler(cfg *config.RelayerConfig, parentLogger zerolog.Logger) (*WalrusHandler, error)
NewWalrusHandler creates and initializes a new WalrusHandler, nil if not enabled
func (*WalrusHandler) StoreBlock ¶
func (wh *WalrusHandler) StoreBlock( rawBlockData []byte, blockHeight int64, blockHashStr string, ) (*string, error)
StoreBlock attempts to store the raw block data in Walrus.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
btcwrapper/zmq
Package zmq reference is taken from https://github.com/joakimofv/go-bitcoindclient which is a go wrapper around official zmq package https://github.com/pebbe/zmq4
|
Package zmq reference is taken from https://github.com/joakimofv/go-bitcoindclient which is a go wrapper around official zmq package https://github.com/pebbe/zmq4 |