eventstore

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusConfirmed = "CONFIRMED"

	// StatusInProgress - TSS signing is in progress
	StatusInProgress = "IN_PROGRESS"

	// StatusBroadcasted - Transaction sent to external chain (for sign events)
	StatusBroadcasted = "BROADCASTED"

	// StatusCompleted - Successfully completed (key events: vote sent, sign events: confirmed)
	StatusCompleted = "COMPLETED"

	// StatusReverted - Event reverted
	StatusReverted = "REVERTED"

	// StatusExpired - Event expired (for key events)
	StatusExpired = "EXPIRED"
)

Event statuses for TSS operations

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store provides database access for TSS events.

func NewStore

func NewStore(db *gorm.DB, logger zerolog.Logger) *Store

NewStore creates a new event store.

func (*Store) CountInProgress added in v0.0.14

func (s *Store) CountInProgress() (int64, error)

CountInProgress returns the number of events with status IN_PROGRESS (TSS or broadcast in flight). Used by the coordinator to cap how many new events to fetch.

func (*Store) CreateEvent

func (s *Store) CreateEvent(event *store.Event) error

CreateEvent stores a new PCEvent. Returns error if event already exists.

func (*Store) GetConfirmedEvents added in v0.0.13

func (s *Store) GetConfirmedEvents(currentBlock uint64, minBlockConfirmation uint64, limit int) ([]store.Event, error)

GetConfirmedEvents returns confirmed events that are ready to be processed. Events are confirmed if they are at least `minBlockConfirmation` blocks behind the current block and not expired. If limit > 0, at most limit events are returned; otherwise all matching events are returned.

func (*Store) GetEvent

func (s *Store) GetEvent(eventID string) (*store.Event, error)

GetEvent retrieves an event by ID.

func (*Store) ResetInProgressEventsToConfirmed added in v0.0.13

func (s *Store) ResetInProgressEventsToConfirmed() (int64, error)

ResetInProgressEventsToConfirmed resets all IN_PROGRESS events to CONFIRMED status. This should be called on node startup to handle cases where the node crashed while events were in progress, causing sessions to be lost from memory.

func (*Store) UpdateBroadcastedTxHash added in v0.0.13

func (s *Store) UpdateBroadcastedTxHash(eventID, txHash string) error

UpdateBroadcastedTxHash updates the BroadcastedTxHash field for an event (used after broadcasting).

func (*Store) UpdateStatus

func (s *Store) UpdateStatus(eventID, status, errorMsg string) error

UpdateStatus updates the status of an event. Note: errorMsg is logged but not stored (Event model doesn't have error_msg field).

func (*Store) UpdateStatusAndBlockHeight added in v0.0.13

func (s *Store) UpdateStatusAndBlockHeight(eventID, status string, blockHeight uint64) error

UpdateStatusAndBlockHeight updates the status and block height of an event.

Jump to

Keyboard shortcuts

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