Documentation
¶
Index ¶
Constants ¶
View Source
const ( NotificationBtcBlocks database.NotificationName = "btc_blocks" NotificationAccessPublicKeyDelete database.NotificationName = "access_public_keys" NotificationL2Keystones database.NotificationName = "l2_keystones" )
NotificationName identifies a database notification type.
View Source
const ( IdentifierBTCNewBlock = "btc-new-block" IdentifierBTCFinality = "btc-finality" )
Variables ¶
View Source
var BTCFinalityNotification = Notification{ ID: IdentifierBTCFinality, }
View Source
var BTCNewBlockNotification = Notification{ ID: IdentifierBTCNewBlock, }
Functions ¶
func NotificationPayload ¶
func NotificationPayload(ntfn database.NotificationName) (any, bool)
NotificationPayload returns the data structure corresponding to the given notification type.
Types ¶
type AccessPublicKey ¶
type Database ¶
type Database interface {
database.Database
// Version table
Version(ctx context.Context) (int, error)
// L2 keystone table
L2KeystonesInsert(ctx context.Context, l2ks []L2Keystone) error
L2KeystonesCount(ctx context.Context) (int, error)
L2KeystoneByAbrevHash(ctx context.Context, aHash [32]byte) (*L2Keystone, error)
L2KeystonesMostRecentN(ctx context.Context, n uint32) ([]L2Keystone, error)
// Btc block table
BtcBlockInsert(ctx context.Context, bb *BtcBlock) error
BtcBlockByHash(ctx context.Context, hash [32]byte) (*BtcBlock, error)
BtcBlockHeightByHash(ctx context.Context, hash [32]byte) (uint64, error)
BtcBlocksHeightsWithNoChildren(ctx context.Context) ([]uint64, error)
// Pop data
PopBasisByL2KeystoneAbrevHash(ctx context.Context, aHash [32]byte, excludeUnconfirmed bool) ([]PopBasis, error)
PopBasisInsertFull(ctx context.Context, pb *PopBasis) error
PopBasisInsertPopMFields(ctx context.Context, pb *PopBasis) error
PopBasisUpdateBTCFields(ctx context.Context, pb *PopBasis) (int64, error)
PopBasisExistsByBtcTxIdUnconfirmed(ctx context.Context, btcTxId [32]byte) (bool, error)
L2BTCFinalityMostRecent(ctx context.Context, limit uint32) ([]L2BTCFinality, error)
L2BTCFinalityByL2KeystoneAbrevHash(ctx context.Context, l2KeystoneAbrevHashes []database.ByteArray) ([]L2BTCFinality, error)
BtcBlockCanonicalHeight(ctx context.Context) (uint64, error)
AccessPublicKeyInsert(ctx context.Context, publicKey *AccessPublicKey) error
AccessPublicKeyExists(ctx context.Context, publicKey *AccessPublicKey) (bool, error)
AccessPublicKeyDelete(ctx context.Context, publicKey *AccessPublicKey) error
}
type L2BTCFinality ¶
type L2Keystone ¶
type L2Keystone struct {
Hash database.ByteArray // lookup key
Version uint32
L1BlockNumber uint32
L2BlockNumber uint32
ParentEPHash database.ByteArray
PrevKeystoneEPHash database.ByteArray
StateRoot database.ByteArray
EPHash database.ByteArray
CreatedAt database.Timestamp `deep:"-"`
UpdatedAt database.Timestamp `deep:"-"`
}
type PopBasis ¶
type PopBasis struct {
ID uint64 `deep:"-"`
BtcTxId database.ByteArray
BtcRawTx database.ByteArray
BtcHeaderHash database.ByteArray
BtcTxIndex *uint64
BtcMerklePath []string
PopTxId database.ByteArray
PopMinerPublicKey database.ByteArray
L2KeystoneAbrevHash database.ByteArray
CreatedAt database.Timestamp `deep:"-"`
UpdatedAt database.Timestamp `deep:"-"`
}
Click to show internal directories.
Click to hide internal directories.