broadcast

package
v0.8.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

package broadcast contains logic for broadcasting events to the Kwil network

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broadcaster

type Broadcaster interface {
	BroadcastTx(ctx context.Context, tx []byte, sync uint8) (res *cmtCoreTypes.ResultBroadcastTx, err error)
}

Broadcaster is an interface for broadcasting to the Kwil network.

type EventBroadcaster

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

EventBroadcaster manages broadcasting events to the Kwil network.

func NewEventBroadcaster

func NewEventBroadcaster(store EventStore, broadcaster Broadcaster, app TxApp, validatorStore ValidatorStore, signer *auth.Ed25519Signer, chainID string) *EventBroadcaster

func (*EventBroadcaster) RunBroadcast

func (e *EventBroadcaster) RunBroadcast(ctx context.Context, Proposer []byte) error

RunBroadcast tells the EventBroadcaster to broadcast any events it wishes. It implements Kwil's abci.CommitHook function signature. If the node is not a validator, it will do nothing. It broadcasts votes for the existing resolutions.

type EventStore

type EventStore interface {
	// GetUnbroadcastedEvents filters out the events observed by the validator
	// that are not previously broadcasted.
	GetUnbroadcastedEvents(ctx context.Context) ([]*types.UUID, error)

	// MarkBroadcasted marks list of events as broadcasted.
	MarkBroadcasted(ctx context.Context, ids []*types.UUID) error
}

EventStore allows the EventBroadcaster to read events from the event store.

type TxApp

type TxApp interface {
	// AccountInfo gets uncommitted information about an account.
	AccountInfo(ctx context.Context, acctID []byte, getUncommitted bool) (balance *big.Int, nonce int64, err error)
	// Price gets the estimated fee for a transaction.
	Price(ctx context.Context, tx *transactions.Transaction) (*big.Int, error)
}

TxApp is the main Kwil application.

type ValidatorStore

type ValidatorStore interface {
	GetValidators(ctx context.Context) ([]*types.Validator, error)
}

ValidatorStore gets data about the local validators.

Jump to

Keyboard shortcuts

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