Documentation
¶
Index ¶
Constants ¶
View Source
const BLOCK_RANGE_SIZE uint64 = 600
The indexer performs a reorg check every 60 blocks. Setting BLOCK_RANGE_SIZE to 600 (10 cycles of 60 blocks) allows us to retrieve a single page of blocks from the database, which will likely contain the reorg point.
Variables ¶
View Source
var ( ErrNoBlocksFound = errors.New("no blocks found") ErrGetBlock = errors.New("failed to get block") )
View Source
var (
ErrEmptyBlockHash = errors.New("block hash is empty")
)
Functions ¶
This section is empty.
Types ¶
type BlockTracker ¶ added in v0.1.1
type BlockTracker struct {
// contains filtered or unexported fields
}
* BlockTracker keeps a database record of the latest block that has been indexed for a contract address and allows the user to increase the value. *
func NewBlockTracker ¶ added in v0.1.1
func NewBlockTracker( ctx context.Context, contractAddress string, queries *queries.Queries, ) (*BlockTracker, error)
Return a new BlockTracker initialized to the latest block from the DB
func (*BlockTracker) GetLatestBlock ¶ added in v0.1.1
func (bt *BlockTracker) GetLatestBlock() (uint64, []byte)
func (*BlockTracker) UpdateLatestBlock ¶ added in v0.1.1
type ChainReorgHandler ¶ added in v0.2.0
type IBlockTracker ¶ added in v0.1.1
type Indexer ¶ added in v0.1.1
type Indexer struct {
// contains filtered or unexported fields
}
func (*Indexer) StartIndexer ¶ added in v0.1.1
func (i *Indexer) StartIndexer( db *sql.DB, cfg config.ContractsOptions, validationService mlsvalidate.MLSValidationService, ) error
type ReorgHandler ¶ added in v0.2.0
type ReorgHandler struct {
// contains filtered or unexported fields
}
func NewChainReorgHandler ¶ added in v0.2.0
func NewChainReorgHandler( ctx context.Context, client blockchain.ChainClient, queries *queries.Queries, ) *ReorgHandler
func (*ReorgHandler) FindReorgPoint ¶ added in v0.2.0
func (r *ReorgHandler) FindReorgPoint(detectedAt uint64) (uint64, []byte, error)
TODO(borja): When reorg range has been calculated, alert clients. Tracked in https://github.com/xmtp/xmtpd/issues/437
Click to show internal directories.
Click to hide internal directories.