eventstore

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 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) 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) ([]store.Event, error)

GetConfirmedEvents returns all 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. This method returns events that have been confirmed on-chain (have enough block confirmations).

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