multi: create channeldb/models package

Add a new subpackage to `lnd/channeldb` to hold some of the types that
are used in the package itself and in other packages that should not
depend on `channeldb`.
This commit is contained in:
positiveblue
2022-11-18 03:15:22 -08:00
parent c602ac07e7
commit 383cb40f8d
29 changed files with 400 additions and 315 deletions

View File

@@ -3,7 +3,7 @@ package htlcswitch
import (
"testing"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/channeldb/models"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/stretchr/testify/require"
)
@@ -12,9 +12,9 @@ func TestHeldHtlcSetEmpty(t *testing.T) {
set := newHeldHtlcSet()
// Test operations on an empty set.
require.False(t, set.exists(channeldb.CircuitKey{}))
require.False(t, set.exists(models.CircuitKey{}))
_, err := set.pop(channeldb.CircuitKey{})
_, err := set.pop(models.CircuitKey{})
require.Error(t, err)
set.popAll(
@@ -27,7 +27,7 @@ func TestHeldHtlcSetEmpty(t *testing.T) {
func TestHeldHtlcSet(t *testing.T) {
set := newHeldHtlcSet()
key := channeldb.CircuitKey{
key := models.CircuitKey{
ChanID: lnwire.NewShortChanIDFromInt(1),
HtlcID: 2,
}
@@ -82,7 +82,7 @@ func TestHeldHtlcSet(t *testing.T) {
func TestHeldHtlcSetAutoFails(t *testing.T) {
set := newHeldHtlcSet()
key := channeldb.CircuitKey{
key := models.CircuitKey{
ChanID: lnwire.NewShortChanIDFromInt(1),
HtlcID: 2,
}