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
L2KeystonesInsertWithTx(ctx context.Context, tx *sql.Tx, l2ks []L2Keystone) error
L2KeystoneByAbrevHash(ctx context.Context, aHash [32]byte) (*L2Keystone, error)
L2KeystonesMostRecentN(ctx context.Context, n uint32, page uint32) ([]L2Keystone, error)
// Btc block table
BtcBlockInsert(ctx context.Context, bb *BtcBlock) error
BtcBlockReplace(ctx context.Context, btcBlock *BtcBlock) (int64, error)
BtcBlockReplaceWithTx(ctx context.Context, tx *sql.Tx, btcBlock *BtcBlock) (int64, error)
BtcBlockByHash(ctx context.Context, hash [32]byte) (*BtcBlock, error)
BtcBlockHeightByHash(ctx context.Context, hash [32]byte) (uint64, error)
BtcBlockUpdateKeystones(ctx context.Context, btcBlockHash [32]byte, btcBlockHeight uint64, ignoreAfter int64) error
// Pop data
PopBasisByL2KeystoneAbrevHash(ctx context.Context, aHash [32]byte, excludeUnconfirmed bool, page uint32) ([]PopBasis, error)
PopBasisInsertFull(ctx context.Context, pb *PopBasis) error
PopBasisInsertFullWithTx(ctx context.Context, tx *sql.Tx, pb *PopBasis) error
PopBasisInsertPopMFields(ctx context.Context, pb *PopBasis) error
PopBasisUpdateBTCFields(ctx context.Context, pb *PopBasis) (int64, error)
PopBasisUpdateBTCFieldsWithTx(ctx context.Context, tx *sql.Tx, pb *PopBasis) (int64, error)
L2BTCFinalityMostRecent(ctx context.Context, limit uint32, ignoreAfterL2Block int64) ([]L2BTCFinality, error)
L2BTCFinalityByL2KeystoneAbrevHash(ctx context.Context, l2KeystoneAbrevHashes []database.ByteArray, ignoreAfterL2Block int64) ([]L2BTCFinality, error)
BtcBlockCanonicalHeight(ctx context.Context) (uint64, error)
BtcTransactionBroadcastRequestInsert(ctx context.Context, serializedTx []byte, txId string) error
BtcTransactionBroadcastRequestGetNext(ctx context.Context, onlyNew bool) ([]byte, error)
BtcTransactionBroadcastRequestConfirmBroadcast(ctx context.Context, txId string) error
BtcTransactionBroadcastRequestSetLastError(ctx context.Context, txId string, lastErr string) error
BtcTransactionBroadcastRequestTrim(ctx context.Context) error
BeginTx(ctx context.Context) (*sql.Tx, error)
Commit(tx *sql.Tx) error
Rollback(tx *sql.Tx) 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 `json:"l2_keystone_abrev_hash"`
CreatedAt database.Timestamp `deep:"-"`
UpdatedAt database.Timestamp `deep:"-"`
}
Click to show internal directories.
Click to hide internal directories.