mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-10 06:07:16 +01:00
watchtower/multi: move BreachHint to blob pkg
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/watchtower/blob"
|
||||
"github.com/lightningnetwork/lnd/watchtower/wtdb"
|
||||
)
|
||||
|
||||
@@ -37,7 +38,7 @@ type DB interface {
|
||||
// QueryMatches searches its database for any state updates matching the
|
||||
// provided breach hints. If any matches are found, they will be
|
||||
// returned along with encrypted blobs so that justice can be exacted.
|
||||
QueryMatches([]wtdb.BreachHint) ([]wtdb.Match, error)
|
||||
QueryMatches([]blob.BreachHint) ([]wtdb.Match, error)
|
||||
|
||||
// SetLookoutTip writes the best epoch for which the watchtower has
|
||||
// queried for breach hints.
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/watchtower/blob"
|
||||
"github.com/lightningnetwork/lnd/watchtower/wtdb"
|
||||
)
|
||||
|
||||
// Config houses the Lookout's required resources to properly fulfill it's duty,
|
||||
@@ -159,11 +158,11 @@ func (l *Lookout) processEpoch(epoch *chainntnfs.BlockEpoch,
|
||||
// Iterate over the transactions contained in the block, deriving a
|
||||
// breach hint for each transaction and constructing an index mapping
|
||||
// the hint back to it's original transaction.
|
||||
hintToTx := make(map[wtdb.BreachHint]*wire.MsgTx, numTxnsInBlock)
|
||||
txHints := make([]wtdb.BreachHint, 0, numTxnsInBlock)
|
||||
hintToTx := make(map[blob.BreachHint]*wire.MsgTx, numTxnsInBlock)
|
||||
txHints := make([]blob.BreachHint, 0, numTxnsInBlock)
|
||||
for _, tx := range block.Transactions {
|
||||
hash := tx.TxHash()
|
||||
hint := wtdb.NewBreachHintFromHash(&hash)
|
||||
hint := blob.NewBreachHintFromHash(&hash)
|
||||
|
||||
txHints = append(txHints, hint)
|
||||
hintToTx[hint] = tx
|
||||
|
||||
@@ -163,13 +163,13 @@ func TestLookoutBreachMatching(t *testing.T) {
|
||||
// Add both state updates to the tower's database.
|
||||
txBlob1 := &wtdb.SessionStateUpdate{
|
||||
ID: makeArray33(1),
|
||||
Hint: wtdb.NewBreachHintFromHash(&hash1),
|
||||
Hint: blob.NewBreachHintFromHash(&hash1),
|
||||
EncryptedBlob: encBlob1,
|
||||
SeqNum: 1,
|
||||
}
|
||||
txBlob2 := &wtdb.SessionStateUpdate{
|
||||
ID: makeArray33(2),
|
||||
Hint: wtdb.NewBreachHintFromHash(&hash2),
|
||||
Hint: blob.NewBreachHintFromHash(&hash2),
|
||||
EncryptedBlob: encBlob2,
|
||||
SeqNum: 1,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user