mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-30 07:35:07 +02:00
watchtower/multi: move BreachHint to blob pkg
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/coreos/bbolt"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/watchtower/blob"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -369,7 +370,7 @@ func (t *TowerDB) DeleteSession(target SessionID) error {
|
||||
// QueryMatches searches against all known state updates for any that match the
|
||||
// passed breachHints. More than one Match will be returned for a given hint if
|
||||
// they exist in the database.
|
||||
func (t *TowerDB) QueryMatches(breachHints []BreachHint) ([]Match, error) {
|
||||
func (t *TowerDB) QueryMatches(breachHints []blob.BreachHint) ([]Match, error) {
|
||||
var matches []Match
|
||||
err := t.db.View(func(tx *bbolt.Tx) error {
|
||||
sessions := tx.Bucket(sessionsBkt)
|
||||
@@ -534,20 +535,20 @@ func removeSessionHintBkt(updateIndex *bbolt.Bucket, id *SessionID) error {
|
||||
// If the index for the session has not been initialized, this method returns
|
||||
// ErrNoSessionHintIndex.
|
||||
func getHintsForSession(updateIndex *bbolt.Bucket,
|
||||
id *SessionID) ([]BreachHint, error) {
|
||||
id *SessionID) ([]blob.BreachHint, error) {
|
||||
|
||||
sessionHints := updateIndex.Bucket(id[:])
|
||||
if sessionHints == nil {
|
||||
return nil, ErrNoSessionHintIndex
|
||||
}
|
||||
|
||||
var hints []BreachHint
|
||||
var hints []blob.BreachHint
|
||||
err := sessionHints.ForEach(func(k, _ []byte) error {
|
||||
if len(k) != BreachHintSize {
|
||||
if len(k) != blob.BreachHintSize {
|
||||
return nil
|
||||
}
|
||||
|
||||
var hint BreachHint
|
||||
var hint blob.BreachHint
|
||||
copy(hint[:], k)
|
||||
hints = append(hints, hint)
|
||||
return nil
|
||||
@@ -565,7 +566,7 @@ func getHintsForSession(updateIndex *bbolt.Bucket,
|
||||
// for the session has not been initialized, this method returns
|
||||
// ErrNoSessionHintIndex.
|
||||
func putHintForSession(updateIndex *bbolt.Bucket, id *SessionID,
|
||||
hint BreachHint) error {
|
||||
hint blob.BreachHint) error {
|
||||
|
||||
sessionHints := updateIndex.Bucket(id[:])
|
||||
if sessionHints == nil {
|
||||
|
Reference in New Issue
Block a user