Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockListener ¶
type BlockListener interface {
ReconcileConfirmationsForTransaction(ctx context.Context, txHash string, existingConfirmations []*ethrpc.MinimalBlockInfo, targetConfirmationCount uint64) (*ConfirmationUpdateResult, *ethrpc.TxReceiptJSONRPC, error)
GetMonitoredHeadLength() int // provides a getter on the configuration for unstable head length - as this information is important to consumers (might be multiple from this block listener)
AddConsumer(ctx context.Context, c *BlockUpdateConsumer)
RemoveConsumer(ctx context.Context, id *fftypes.UUID)
GetHighestBlock(ctx context.Context) (uint64, bool)
GetHighestBlockInfo(ctx context.Context) (*ethrpc.BlockInfoJSONRPC, bool)
GetBlockGasLimit() *ethtypes.HexInteger // nil if unknown
GetBlockInfoByNumber(ctx context.Context, blockNumber uint64, allowCache bool, expectedParentHashStr string, expectedBlockHashStr string) (*ethrpc.BlockInfoJSONRPC, error)
GetBlockInfoByHash(ctx context.Context, hash0xString string) (*ethrpc.BlockInfoJSONRPC, error)
GetEVMBlockWithTxHashesByHash(ctx context.Context, hash0xString string) (b *ethrpc.EVMBlockWithTxHashesJSONRPC, err error)
GetEVMBlockWithTransactionsByHash(ctx context.Context, hash0xString string) (b *ethrpc.EVMBlockWithTransactionsJSONRPC, err error)
GetEVMBlockWithTxHashesByNumber(ctx context.Context, numberLookup string) (b *ethrpc.EVMBlockWithTxHashesJSONRPC, err error)
GetEVMBlockWithTransactionsByNumber(ctx context.Context, numberLookup string) (b *ethrpc.EVMBlockWithTransactionsJSONRPC, err error)
FetchBlockReceiptsAsync(blockNumber uint64, blockHash ethtypes.HexBytes0xPrefix, cb func([]*ethrpc.TxReceiptJSONRPC, error))
SnapshotMonitoredHeadChain() []*ethrpc.BlockInfoJSONRPC // snapshot the whole view, with complete blocks, using the read-lock.
WaitClosed()
InitMetrics(ctx context.Context, registry metric.MetricsRegistry) error
// Light chain tracking mode drift accounting (see ffcapi.ChainTrackingModeLight), recorded by the
// event streams that observe the eth_getLogs failures - no-ops without metrics initialized.
IncLightModeRangeAhead() // an eth_getLogs page above the stable threshold was rejected (a node behind the observed head - expected, retried without backoff)
IncLightModeDriftViolation() // an eth_getLogs page at/below the stable threshold was rejected (a node more than checkpointBlockGap behind - a drift violation)
}
func NewBlockListener ¶
func NewBlockListener(ctx context.Context, retry *retry.Retry, conf *BlockListenerConfig, rpc ethrpc.Client) (_ BlockListener, err error)
type BlockListenerConfig ¶
type BlockListenerConfig struct {
MonitoredHeadLength int `json:"monitoredHeadLength"`
BlockPollingInterval time.Duration `json:"blockPollingInterval"`
HederaCompatibilityMode bool `json:"hederaCompatibilityMode"`
BlockCacheSize int `json:"blockCacheSize"`
ReceiptCacheEnabled bool `json:"receiptCacheEnabled"`
ReceiptCacheSize int `json:"receiptCacheSize"`
IncludeLogsBloom bool `json:"includeLogsBloom"`
UseGetBlockReceipts bool `json:"useGetBlockReceipts"`
MaxAsyncBlockFetchConcurrency int `json:"maxAsyncBlockFetchConcurrency"`
ChainTrackingMode ffcapi.ChainTrackingMode `json:"chainTrackingMode,omitempty"`
FilterPollingMode FilterPollingMode `json:"filterPollingMode,omitempty"`
}
type BlockUpdateConsumer ¶
type ConfirmationUpdateResult ¶
type ConfirmationUpdateResult struct {
Confirmations []*ethrpc.MinimalBlockInfo `json:"confirmations,omitempty" ffstruct:"ConfirmationUpdateResult"` // the confirmation list
Rebuilt bool `json:"rebuilt,omitempty" ffstruct:"ConfirmationUpdateResult"` // when true, it means the existing confirmations contained invalid blocks, the new confirmations are rebuilt from scratch
NewFork bool `json:"newFork,omitempty" ffstruct:"ConfirmationUpdateResult"` // when true, it means a new fork was detected based on the existing confirmations
Confirmed bool `json:"confirmed,omitempty" ffstruct:"ConfirmationUpdateResult"` // when true, it means the confirmation list is complete and the transaction is confirmed
TargetConfirmationCount uint64 `json:"targetConfirmationCount" ffstruct:"ConfirmationUpdateResult"` // the target number of confirmations for this reconcile request
CurrentConfirmationCount uint64 `json:"currentConfirmationCount" ffstruct:"ConfirmationUpdateResult"` // the current number of confirmations for this reconcile request
TxnBlockTimestamp *ethtypes.HexUint64 `json:"txnBlockTimestamp,omitempty" ffstruct:"ConfirmationUpdateResult"` // the on-chain timestamp of the block the transaction was included in - not a confirmation-finality guarantee, this can change if the chain forks before Confirmed becomes true. Only populated in "full" chain tracking mode, since "light" mode never fetches a block
}
a linked list of accumulated confirmations for a transaction the list is sorted by block number
- the first block is the block that contains the transaction hash
- the last block is the most recent confirmation
this list can be used as input to the future reconcile request to avoid re-fetching the blocks if they are no longer in the in-memory partial chain WARNING: mutation to this list is not expected, invalid modifications will cause inefficiencies in the reconciliation process
`rebuilt` will be true if an invalid confirmation list is detected by the reconciliation process
type FilterPollingMode ¶ added in v1.5.3
type FilterPollingMode string
FilterPollingMode determines how new blocks are discovered by the listen loop
const ( // FilterPollingModeServer establishes a node-side filter with eth_newBlockFilter and polls it // with eth_getFilterChanges, so the node tracks which blocks are new since the last poll FilterPollingModeServer FilterPollingMode = "server" // FilterPollingModeClient polls the head block with eth_getBlockByNumber and reconciles it into the // canonical chain, which fills any gap or re-org itself - avoiding node-side filter state entirely FilterPollingModeClient FilterPollingMode = "client" )
Click to show internal directories.
Click to hide internal directories.