Documentation ¶
Index ¶
- func NotMalicious(data *ATX, _ lockGuard) bool
- func Warmup(db sql.Executor, cache *Data, keep types.EpochID) error
- type ATX
- type AtxFilter
- type Data
- func (d *Data) Add(epoch types.EpochID, node types.NodeID, coinbase types.Address, ...) *ATX
- func (d *Data) AddAtx(target types.EpochID, id types.ATXID, atx *ATX) bool
- func (d *Data) AddFromHeader(atx *types.ActivationTxHeader, nonce types.VRFPostIndex, malicious bool) *ATX
- func (d *Data) EvictEpoch(evict types.EpochID)
- func (d *Data) Evicted() types.EpochID
- func (d *Data) Get(epoch types.EpochID, atx types.ATXID) *ATX
- func (d *Data) IsEvicted(epoch types.EpochID) bool
- func (d *Data) IsMalicious(node types.NodeID) bool
- func (d *Data) IterateInEpoch(epoch types.EpochID, fn func(types.ATXID, *ATX), filters ...AtxFilter)
- func (d *Data) MissingInEpoch(epoch types.EpochID, atxs []types.ATXID) []types.ATXID
- func (d *Data) SetMalicious(node types.NodeID)
- func (d *Data) WeightForSet(epoch types.EpochID, set []types.ATXID) (uint64, []bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NotMalicious ¶ added in v1.4.0
Types ¶
type ATX ¶
type ATX struct { Node types.NodeID Coinbase types.Address Weight uint64 BaseHeight, Height uint64 Nonce types.VRFPostIndex // contains filtered or unexported fields }
SAFETY: all exported fields are read-only and are safe to read concurrently. Thanks to the fact that ATX is immutable, it is safe to return a pointer to it.
type AtxFilter ¶ added in v1.4.0
AtxFilter is a function that filters atxs. The `lockGuard` prevents using the filter functions outside of the allowed context to prevent data races.
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
func (*Data) Add ¶
func (d *Data) Add( epoch types.EpochID, node types.NodeID, coinbase types.Address, atxid types.ATXID, weight, baseHeight, height uint64, nonce types.VRFPostIndex, malicious bool, ) *ATX
Add adds ATX data to the store. Returns the ATX that was added to the store (if any) or `nil` if it wasn't.
func (*Data) AddAtx ¶ added in v1.4.0
Add adds ATX data to the store. Returns whether the ATX was added to the store.
func (*Data) AddFromHeader ¶ added in v1.4.0
func (d *Data) AddFromHeader(atx *types.ActivationTxHeader, nonce types.VRFPostIndex, malicious bool) *ATX
AddFromVerified extracts relevant fields from verified atx and adds them together with nonce and malicious flag. Returns the ATX that was added to the store (if any) or `nil` if it wasn't.
func (*Data) EvictEpoch ¶ added in v1.4.3
EvictEpoch is a notification for cache to evict epochs that are not useful to keep in memory.
func (*Data) IterateInEpoch ¶ added in v1.4.0
func (d *Data) IterateInEpoch(epoch types.EpochID, fn func(types.ATXID, *ATX), filters ...AtxFilter)
IterateInEpoch calls `fn` for every ATX in epoch. If filters are provided, only atxs that pass all filters are returned. SAFETY: The returned pointer MUST NOT be modified.