Documentation ¶
Index ¶
- type Listener
- func (lsn *Listener) Close() error
- func (lsn *Listener) HandleLog(lb log.Broadcast)
- func (lsn *Listener) JobID() int32
- func (lsn *Listener) OnNewLongestChain(_ context.Context, head *evmtypes.Head)
- func (lsn *Listener) ProcessRequest(ctx context.Context, req request) bool
- func (lsn *Listener) ReplayStartedCallback()
- func (lsn *Listener) ReqsConfirmedAt() (us []uint64)
- func (lsn *Listener) RespCount(reqIDBytes [32]byte) uint64
- func (lsn *Listener) RunHeadListener(unsubscribe func())
- func (lsn *Listener) RunLogListener(unsubscribes []func(), minConfs uint32)
- func (lsn *Listener) SetReqAdded(fn func())
- func (lsn *Listener) SetRespCount(reqIDBytes [32]byte, c uint64)
- func (lsn *Listener) Start(context.Context) error
- func (lsn *Listener) Stop(t *testing.T)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Listener ¶
type Listener struct { utils.StartStopOnce Cfg vrfcommon.Config FeeCfg vrfcommon.FeeConfig L logger.SugaredLogger LogBroadcaster log.Broadcaster Coordinator *solidity_vrf_coordinator_interface.VRFCoordinator PipelineRunner pipeline.Runner Job job.Job Q pg.Q HeadBroadcaster httypes.HeadBroadcasterRegistry Txm txmgr.TxManager GethKs vrfcommon.GethKeyStore MailMon *utils.MailboxMonitor ReqLogs *utils.Mailbox[log.Broadcast] ChStop utils.StopChan WaitOnStop chan struct{} NewHead chan struct{} LatestHead uint64 LatestHeadMu sync.RWMutex // We can keep these pending logs in memory because we // only mark them confirmed once we send a corresponding fulfillment transaction. // So on node restart in the middle of processing, the lb will resend them. ReqsMu sync.Mutex // Both goroutines write to Reqs Reqs []request ReqAdded func() // A simple debug helper // Data structures for reorg attack protection // We want a map so we can do an O(1) count update every fulfillment log we get. RespCountMu sync.Mutex ResponseCount map[[32]byte]uint64 // This auxiliary heap is to used when we need to purge the // ResponseCount map - we repeatedly want remove the minimum log. // You could use a sorted list if the completed logs arrive in order, but they may not. BlockNumberToReqID *pairing.PairHeap // Deduper prevents processing duplicate requests from the log broadcaster. Deduper *vrfcommon.LogDeduper }
func (*Listener) OnNewLongestChain ¶
Note that we have 2 seconds to do this processing
func (*Listener) ProcessRequest ¶
ProcessRequest attempts to process the VRF request. Returns true if successful, false otherwise.
func (*Listener) ReplayStartedCallback ¶
func (lsn *Listener) ReplayStartedCallback()
ReplayStartedCallback is called by the log broadcaster when a replay is about to start.
func (*Listener) ReqsConfirmedAt ¶
func (*Listener) RunHeadListener ¶
func (lsn *Listener) RunHeadListener(unsubscribe func())
Listen for new heads
func (*Listener) RunLogListener ¶
func (*Listener) SetReqAdded ¶
func (lsn *Listener) SetReqAdded(fn func())
func (*Listener) SetRespCount ¶
Click to show internal directories.
Click to hide internal directories.