doublesign

package
v0.0.1-dev Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoConnections       = errors.New("no connections")
	ErrP2PSyncOngoing      = errors.New("P2P synchronization isn't finished")
	ErrSelfEventsOngoing   = errors.New("not downloaded all the self-events")
	ErrJustBecameValidator = errors.New("just joined the validators group")
	ErrJustConnected       = errors.New("recently connected")
	ErrJustP2PSynced       = errors.New("waiting additional time")
)

Functions

func DetectParallelInstance

func DetectParallelInstance(s SyncStatus, threshold time.Duration) bool

DetectParallelInstance should be called after downloading a self-event which wasn't created on this instance Returns true if a parallel instance is likely be running

func SyncedToEmit

func SyncedToEmit(s SyncStatus, threshold time.Duration) (time.Duration, error)

SyncedToEmit should be called before emitting any events It returns nil if node is allowed to emit events Otherwise, node returns a minimum duration of how long node should wait before emitting

Types

type SyncStatus

type SyncStatus struct {
	PeersNum                  int
	Now                       time.Time
	Startup                   time.Time
	LastConnected             time.Time
	P2PSynced                 time.Time
	BecameValidator           time.Time
	ExternalSelfEventCreated  time.Time
	ExternalSelfEventDetected time.Time
}

func (*SyncStatus) Since

func (s *SyncStatus) Since(t time.Time) time.Duration

Jump to

Keyboard shortcuts

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