Versions in this module Expand all Collapse all v0 v0.1.9 Jan 17, 2023 Changes in this version + const SessionIDSize + var ErrChannelAlreadyRegistered = errors.New("channel already registered") + var ErrChannelNotRegistered = errors.New("channel not registered") + var ErrClientSessionAlreadyExists = errors.New("client session already exists") + var ErrClientSessionNotFound = errors.New("client session not found") + var ErrCommitUnorderedUpdate = errors.New("update seqnum not monotonic") + var ErrCommittedUpdateNotFound = errors.New("committed update not found") + var ErrCorruptClientSession = errors.New("client session corrupted") + var ErrIncorrectKeyIndex = errors.New("incorrect key index") + var ErrInvalidBlobSize = errors.New("invalid blob size") + var ErrLastAppliedReversion = errors.New(...) + var ErrLastTowerAddr = errors.New("cannot remove last tower address") + var ErrNoDBVersion = errors.New("db has no version") + var ErrNoReservedKeyIndex = errors.New("key index not reserved") + var ErrNoSessionHintIndex = errors.New("session hint index missing") + var ErrSeqNumAlreadyApplied = errors.New(...) + var ErrSessionAlreadyExists = errors.New("session already exists") + var ErrSessionConsumed = errors.New(...) + var ErrSessionNotFound = errors.New("session not found in db") + var ErrTowerNotFound = errors.New("tower not found") + var ErrTowerUnackedUpdates = errors.New("tower has unacked updates") + var ErrUnallocatedLastApplied = errors.New(...) + var ErrUninitializedDB = errors.New("db not initialized") + var ErrUpdateAlreadyCommitted = errors.New("update already committed") + var ErrUpdateOutOfOrder = errors.New(...) + func DisableLog() + func NewBoltBackendCreator(active bool, dbPath, dbFileName string) func(boltCfg *kvdb.BoltConfig) (kvdb.Backend, error) + func ReadElement(r io.Reader, element interface{}) error + func ReadElements(r io.Reader, elements ...interface{}) error + func UseLogger(logger btclog.Logger) + func WriteElement(w io.Writer, element interface{}) error + func WriteElements(w io.Writer, elements ...interface{}) error + type BackupID struct + ChanID lnwire.ChannelID + CommitHeight uint64 + func (b *BackupID) Decode(r io.Reader) error + func (b *BackupID) Encode(w io.Writer) error + func (b BackupID) String() string + type CSessionStatus uint8 + const CSessionActive + const CSessionInactive + type ChannelSummaries map[lnwire.ChannelID]ClientChanSummary + type ClientChanSummary struct + SweepPkScript []byte + func (s *ClientChanSummary) Decode(r io.Reader) error + func (s *ClientChanSummary) Encode(w io.Writer) error + type ClientDB struct + func OpenClientDB(db kvdb.Backend) (*ClientDB, error) + func (c *ClientDB) AckUpdate(id *SessionID, seqNum uint16, lastApplied uint16) error + func (c *ClientDB) Close() error + func (c *ClientDB) CommitUpdate(id *SessionID, update *CommittedUpdate) (uint16, error) + func (c *ClientDB) CreateClientSession(session *ClientSession) error + func (c *ClientDB) CreateTower(lnAddr *lnwire.NetAddress) (*Tower, error) + func (c *ClientDB) FetchChanSummaries() (ChannelSummaries, error) + func (c *ClientDB) ListClientSessions(id *TowerID) (map[SessionID]*ClientSession, error) + func (c *ClientDB) ListTowers() ([]*Tower, error) + func (c *ClientDB) LoadTower(pubKey *btcec.PublicKey) (*Tower, error) + func (c *ClientDB) LoadTowerByID(towerID TowerID) (*Tower, error) + func (c *ClientDB) MarkBackupIneligible(chanID lnwire.ChannelID, commitHeight uint64) error + func (c *ClientDB) NextSessionKeyIndex(towerID TowerID, blobType blob.Type) (uint32, error) + func (c *ClientDB) RegisterChannel(chanID lnwire.ChannelID, sweepPkScript []byte) error + func (c *ClientDB) RemoveTower(pubKey *btcec.PublicKey, addr net.Addr) error + func (c *ClientDB) Version() (uint32, error) + type ClientSession struct + AckedUpdates map[uint16]BackupID + CommittedUpdates []CommittedUpdate + ID SessionID + SessionKeyECDH keychain.SingleKeyECDH + Tower *Tower + type ClientSessionBody struct + KeyIndex uint32 + Policy wtpolicy.Policy + RewardPkScript []byte + SeqNum uint16 + Status CSessionStatus + TowerID TowerID + TowerLastApplied uint16 + func (s *ClientSessionBody) Decode(r io.Reader) error + func (s *ClientSessionBody) Encode(w io.Writer) error + type CommittedUpdate struct + SeqNum uint16 + type CommittedUpdateBody struct + BackupID BackupID + EncryptedBlob []byte + Hint blob.BreachHint + func (u *CommittedUpdateBody) Decode(r io.Reader) error + func (u *CommittedUpdateBody) Encode(w io.Writer) error + type Match struct + EncryptedBlob []byte + Hint blob.BreachHint + ID SessionID + SeqNum uint16 + SessionInfo *SessionInfo + type SessionID [SessionIDSize]byte + func NewSessionIDFromPubKey(pubKey *btcec.PublicKey) SessionID + func (s SessionID) String() string + type SessionInfo struct + ClientLastApplied uint16 + ID SessionID + LastApplied uint16 + Policy wtpolicy.Policy + RewardAddress []byte + func (s *SessionInfo) AcceptUpdateSequence(seqNum, lastApplied uint16) error + func (s *SessionInfo) Decode(r io.Reader) error + func (s *SessionInfo) Encode(w io.Writer) error + type SessionStateUpdate struct + EncryptedBlob []byte + Hint blob.BreachHint + ID SessionID + LastApplied uint16 + SeqNum uint16 + func (u *SessionStateUpdate) Decode(r io.Reader) error + func (u *SessionStateUpdate) Encode(w io.Writer) error + type Tower struct + Addresses []net.Addr + ID TowerID + IdentityKey *btcec.PublicKey + func (t *Tower) AddAddress(addr net.Addr) + func (t *Tower) Decode(r io.Reader) error + func (t *Tower) Encode(w io.Writer) error + func (t *Tower) LNAddrs() []*lnwire.NetAddress + func (t *Tower) RemoveAddress(addr net.Addr) + func (t *Tower) String() string + type TowerDB struct + func OpenTowerDB(db kvdb.Backend) (*TowerDB, error) + func (t *TowerDB) Close() error + func (t *TowerDB) DeleteSession(target SessionID) error + func (t *TowerDB) GetLookoutTip() (*chainntnfs.BlockEpoch, error) + func (t *TowerDB) GetSessionInfo(id *SessionID) (*SessionInfo, error) + func (t *TowerDB) InsertSessionInfo(session *SessionInfo) error + func (t *TowerDB) InsertStateUpdate(update *SessionStateUpdate) (uint16, error) + func (t *TowerDB) QueryMatches(breachHints []blob.BreachHint) ([]Match, error) + func (t *TowerDB) SetLookoutTip(epoch *chainntnfs.BlockEpoch) error + func (t *TowerDB) Version() (uint32, error) + type TowerID uint64 + func TowerIDFromBytes(towerIDBytes []byte) TowerID + func (id TowerID) Bytes() []byte + type UnknownElementType = channeldb.UnknownElementType