mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-30 23:53:41 +02:00
multi: move DB schemas to channeldb/models
This commit moves the ChannelEdgePolicy, ChannelEdgeInfo, ChanelAuthProof and CachedEdgePolicy structs to the `channeldb/models` package.
This commit is contained in:
@@ -31,8 +31,8 @@ type Manager struct {
|
||||
// ForAllOutgoingChannels is required to iterate over all our local
|
||||
// channels.
|
||||
ForAllOutgoingChannels func(cb func(kvdb.RTx,
|
||||
*channeldb.ChannelEdgeInfo,
|
||||
*channeldb.ChannelEdgePolicy) error) error
|
||||
*models.ChannelEdgeInfo,
|
||||
*models.ChannelEdgePolicy) error) error
|
||||
|
||||
// FetchChannel is used to query local channel parameters. Optionally an
|
||||
// existing db tx can be supplied.
|
||||
@@ -73,8 +73,8 @@ func (r *Manager) UpdatePolicy(newSchema routing.ChannelPolicy,
|
||||
// otherwise we'll collect them all.
|
||||
err := r.ForAllOutgoingChannels(func(
|
||||
tx kvdb.RTx,
|
||||
info *channeldb.ChannelEdgeInfo,
|
||||
edge *channeldb.ChannelEdgePolicy) error {
|
||||
info *models.ChannelEdgeInfo,
|
||||
edge *models.ChannelEdgePolicy) error {
|
||||
|
||||
// If we have a channel filter, and this channel isn't a part
|
||||
// of it, then we'll skip it.
|
||||
@@ -172,7 +172,7 @@ func (r *Manager) UpdatePolicy(newSchema routing.ChannelPolicy,
|
||||
|
||||
// updateEdge updates the given edge with the new schema.
|
||||
func (r *Manager) updateEdge(tx kvdb.RTx, chanPoint wire.OutPoint,
|
||||
edge *channeldb.ChannelEdgePolicy,
|
||||
edge *models.ChannelEdgePolicy,
|
||||
newSchema routing.ChannelPolicy) error {
|
||||
|
||||
// Update forwarding fee scheme and required time lock delta.
|
||||
|
@@ -22,7 +22,7 @@ func TestManager(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
type channel struct {
|
||||
edgeInfo *channeldb.ChannelEdgeInfo
|
||||
edgeInfo *models.ChannelEdgeInfo
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -44,7 +44,7 @@ func TestManager(t *testing.T) {
|
||||
MaxHTLC: 5000,
|
||||
}
|
||||
|
||||
currentPolicy := channeldb.ChannelEdgePolicy{
|
||||
currentPolicy := models.ChannelEdgePolicy{
|
||||
MinHTLC: minHTLC,
|
||||
MessageFlags: lnwire.ChanUpdateRequiredMaxHtlc,
|
||||
}
|
||||
@@ -107,8 +107,8 @@ func TestManager(t *testing.T) {
|
||||
}
|
||||
|
||||
forAllOutgoingChannels := func(cb func(kvdb.RTx,
|
||||
*channeldb.ChannelEdgeInfo,
|
||||
*channeldb.ChannelEdgePolicy) error) error {
|
||||
*models.ChannelEdgeInfo,
|
||||
*models.ChannelEdgePolicy) error) error {
|
||||
|
||||
for _, c := range channelSet {
|
||||
if err := cb(nil, c.edgeInfo, ¤tPolicy); err != nil {
|
||||
@@ -152,7 +152,7 @@ func TestManager(t *testing.T) {
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
currentPolicy channeldb.ChannelEdgePolicy
|
||||
currentPolicy models.ChannelEdgePolicy
|
||||
newPolicy routing.ChannelPolicy
|
||||
channelSet []channel
|
||||
specifiedChanPoints []wire.OutPoint
|
||||
@@ -166,7 +166,7 @@ func TestManager(t *testing.T) {
|
||||
newPolicy: newPolicy,
|
||||
channelSet: []channel{
|
||||
{
|
||||
edgeInfo: &channeldb.ChannelEdgeInfo{
|
||||
edgeInfo: &models.ChannelEdgeInfo{
|
||||
Capacity: chanCap,
|
||||
ChannelPoint: chanPointValid,
|
||||
},
|
||||
@@ -183,7 +183,7 @@ func TestManager(t *testing.T) {
|
||||
newPolicy: newPolicy,
|
||||
channelSet: []channel{
|
||||
{
|
||||
edgeInfo: &channeldb.ChannelEdgeInfo{
|
||||
edgeInfo: &models.ChannelEdgeInfo{
|
||||
Capacity: chanCap,
|
||||
ChannelPoint: chanPointValid,
|
||||
},
|
||||
@@ -200,7 +200,7 @@ func TestManager(t *testing.T) {
|
||||
newPolicy: newPolicy,
|
||||
channelSet: []channel{
|
||||
{
|
||||
edgeInfo: &channeldb.ChannelEdgeInfo{
|
||||
edgeInfo: &models.ChannelEdgeInfo{
|
||||
Capacity: chanCap,
|
||||
ChannelPoint: chanPointValid,
|
||||
},
|
||||
@@ -221,7 +221,7 @@ func TestManager(t *testing.T) {
|
||||
newPolicy: noMaxHtlcPolicy,
|
||||
channelSet: []channel{
|
||||
{
|
||||
edgeInfo: &channeldb.ChannelEdgeInfo{
|
||||
edgeInfo: &models.ChannelEdgeInfo{
|
||||
Capacity: chanCap,
|
||||
ChannelPoint: chanPointValid,
|
||||
},
|
||||
|
Reference in New Issue
Block a user