Documentation ¶
Index ¶
- Constants
- func Add(db sql.Executor, atx *types.ActivationTx, blob types.AtxBlob) error
- func AddBlob(db sql.Executor, id types.ATXID, blob []byte, version types.AtxVersion) error
- func AddCheckpointed(db sql.Executor, catx *CheckpointAtx) error
- func All(db sql.Executor) ([]types.ATXID, error)
- func AllUnits(db sql.Executor, id types.ATXID) (map[types.NodeID]uint32, error)
- func AtxAdded(db sql.Executor, atx *types.ActivationTx)
- func AtxWithPrevious(db sql.Executor, prev types.ATXID, id types.NodeID) (types.ATXID, error)
- func Coinbase(db sql.Executor, id types.NodeID) (types.Address, error)
- func CommitmentATX(db sql.Executor, nodeID types.NodeID) (id types.ATXID, err error)
- func CountAtxsByOps(db sql.Executor, operations builder.Operations) (count uint32, err error)
- func FilterAll(types.ATXID) bool
- func FindDoublePublish(db sql.Executor, nodeID types.NodeID, epoch types.EpochID) ([]types.ATXID, error)
- func Get(db sql.Executor, id types.ATXID) (*types.ActivationTx, error)
- func GetBlobSizes(db sql.Executor, ids [][]byte) (sizes []int, err error)
- func GetByEpochAndNodeID(db sql.Executor, epoch types.EpochID, nodeID types.NodeID) (types.ATXID, error)
- func GetFirstIDByNodeID(db sql.Executor, nodeID types.NodeID) (id types.ATXID, err error)
- func GetIDByEpochAndNodeID(db sql.Executor, epoch types.EpochID, nodeID types.NodeID) (id types.ATXID, err error)
- func GetIDWithMaxHeight(db sql.Executor, pref types.NodeID, filter Filter) (types.ATXID, error)
- func GetIDsByEpoch(ctx context.Context, db sql.Executor, epoch types.EpochID) (ids []types.ATXID, err error)
- func GetLastIDByNodeID(db sql.Executor, nodeID types.NodeID) (id types.ATXID, err error)
- func Has(db sql.Executor, id types.ATXID) (bool, error)
- func IdentityExists(db sql.Executor, nodeID types.NodeID) (bool, error)
- func IterateAtxIdsWithMalfeasance(db sql.Executor, publish types.EpochID, ...) error
- func IterateAtxsData(db sql.Executor, from, to types.EpochID, ...) error
- func IterateAtxsOps(db sql.Executor, operations builder.Operations, ...) error
- func IterateAtxsWithMalfeasance(db sql.Executor, publish types.EpochID, ...) error
- func IterateForGrading(db sql.Executor, epoch types.EpochID, ...) error
- func LatestEpoch(db sql.Executor) (types.EpochID, error)
- func LoadBlob(ctx context.Context, db sql.Executor, id []byte, blob *sql.Blob) (types.AtxVersion, error)
- func MergeConflict(db sql.Executor, marriage types.ATXID, publish types.EpochID) ([]types.ATXID, error)
- func NonceByID(db sql.Executor, id types.ATXID) (nonce types.VRFPostIndex, err error)
- func PrevATXCollision(db sql.Executor, prev types.ATXID, id types.NodeID) (types.ATXID, types.ATXID, error)
- func PrevIDByNodeID(db sql.Executor, nodeID types.NodeID, pubEpoch types.EpochID) (id types.ATXID, err error)
- func Previous(db sql.Executor, id types.ATXID) ([]types.ATXID, error)
- func SetPost(db sql.Executor, atxID, prev types.ATXID, prevIndex int, id types.NodeID, ...) error
- func SetValidity(db sql.Executor, id types.ATXID, validity types.Validity) error
- func Units(db sql.Executor, atxID types.ATXID, nodeID types.NodeID) (uint32, error)
- func VRFNonce(db sql.Executor, id types.NodeID, epoch types.EpochID) (nonce types.VRFPostIndex, err error)
- type CheckpointAtx
- type Filter
Constants ¶
const ( CacheKindEpochATXs sql.QueryCacheKind = "epoch-atxs" CacheKindATXBlob sql.QueryCacheKind = "atx-blob" )
Variables ¶
This section is empty.
Functions ¶
func AddCheckpointed ¶
func AddCheckpointed(db sql.Executor, catx *CheckpointAtx) error
func AtxAdded ¶ added in v1.4.2
func AtxAdded(db sql.Executor, atx *types.ActivationTx)
AtxAdded updates epoch query cache with new ATX, if the query cache is enabled.
func AtxWithPrevious ¶ added in v1.7.0
AtxWithPrevious returns the ATX ID that has the given ATX ID as its previous ATX.
func Coinbase ¶ added in v1.6.0
Coinbase retrieves the last coinbase address used by the given node ID.
func CommitmentATX ¶
func CountAtxsByOps ¶ added in v1.4.0
func FindDoublePublish ¶ added in v1.7.0
func FindDoublePublish(db sql.Executor, nodeID types.NodeID, epoch types.EpochID) ([]types.ATXID, error)
FindDoublePublish finds 2 distinct ATXIDs that the given identity contributed PoST to in the given epoch.
It is guaranteed to return 2 distinct ATXs when the error is nil. It works by finding an ATX in the given epoch that has a PoST contribution from the given identity. - `epoch` is looked up in the `atxs` table by matching atxid.
func GetBlobSizes ¶ added in v1.4.1
GetBlobSizes returns the sizes of the blobs corresponding to ATXs with specified ids. For non-existent ATXs, the corresponding items are set to -1.
func GetByEpochAndNodeID ¶
func GetByEpochAndNodeID( db sql.Executor, epoch types.EpochID, nodeID types.NodeID, ) (types.ATXID, error)
GetByEpochAndNodeID gets any ATX by the specified NodeID published in the given epoch.
func GetFirstIDByNodeID ¶
GetFirstIDByNodeID gets the initial ATX ID for a given node ID.
func GetIDByEpochAndNodeID ¶
func GetIDByEpochAndNodeID(db sql.Executor, epoch types.EpochID, nodeID types.NodeID) (id types.ATXID, err error)
GetIDByEpochAndNodeID gets an ATX ID for a given epoch and node ID.
func GetIDWithMaxHeight ¶
GetIDWithMaxHeight returns the ID of the atx from the last 2 epoch with the highest (or tied for the highest) tick height. It is possible that some poet servers are faster than others and the network ends up having its highest ticked atx still in previous epoch and the atxs building on top of it have not been published yet. Selecting from the last two epochs to strike a balance between being fair to honest miners while not giving unfair advantage for malicious actors who retroactively publish a high tick atx many epochs back.
func GetIDsByEpoch ¶
func GetIDsByEpoch(ctx context.Context, db sql.Executor, epoch types.EpochID) (ids []types.ATXID, err error)
GetIDsByEpoch gets ATX IDs for a given epoch.
func GetLastIDByNodeID ¶
GetLastIDByNodeID gets the last ATX ID for a given node ID.
func IdentityExists ¶ added in v1.6.0
IdentityExists checks if an identity has ever published an ATX.
func IterateAtxIdsWithMalfeasance ¶ added in v1.6.0
func IterateAtxsData ¶ added in v1.4.0
func IterateAtxsData( db sql.Executor, from, to types.EpochID, fn func( id types.ATXID, node types.NodeID, epoch types.EpochID, coinbase types.Address, weight uint64, base uint64, height uint64, nonce types.VRFPostIndex, ) bool, ) error
IterateAtxsData iterate over data used for consensus.
func IterateAtxsOps ¶ added in v1.4.0
func IterateAtxsOps( db sql.Executor, operations builder.Operations, fn func(*types.ActivationTx) bool, ) error
func IterateAtxsWithMalfeasance ¶ added in v1.6.0
func IterateForGrading ¶ added in v1.4.3
func IterateForGrading( db sql.Executor, epoch types.EpochID, fn func(id types.ATXID, atxtime, prooftime int64, weight uint64) bool, ) error
IterateForGrading selects every atx from publish epoch and joins identities to load malfeasence proofs if they exist.
func LoadBlob ¶ added in v1.4.1
func LoadBlob(ctx context.Context, db sql.Executor, id []byte, blob *sql.Blob) (types.AtxVersion, error)
LoadBlob loads ATX as an encoded blob, ready to be sent over the wire.
func MergeConflict ¶ added in v1.7.0
func MergeConflict(db sql.Executor, marriage types.ATXID, publish types.EpochID) ([]types.ATXID, error)
Find 2 distinct merged ATXs (having the same marriage ATX) in the same epoch.
func NonceByID ¶ added in v1.5.0
NonceByID retrieves VRFNonce corresponding to the specified ATX ID.
func PrevATXCollision ¶ added in v1.5.3
func PrevIDByNodeID ¶ added in v1.5.3
func PrevIDByNodeID(db sql.Executor, nodeID types.NodeID, pubEpoch types.EpochID) (id types.ATXID, err error)
PrevIDByNodeID returns the previous ATX ID for a given node ID and public epoch. It returns the newest ATX ID containing PoST of the given node ID that was published before the given public epoch.
func SetValidity ¶ added in v1.4.0
Types ¶
type CheckpointAtx ¶
type CheckpointAtx struct { ID types.ATXID Epoch types.EpochID CommitmentATX types.ATXID MarriageATX *types.ATXID VRFNonce types.VRFPostIndex BaseTickHeight uint64 TickCount uint64 SmesherID types.NodeID Sequence uint64 Coinbase types.Address // total effective units NumUnits uint32 // actual units of each included smesher Units map[types.NodeID]uint32 }