channeldb: remove kvdb.Backend from ChannelEdgePolicy
This commit is contained in:
2 files changed
-24
No files matched your search
@@ -3438,8 +3438,6 @@ type ChannelEdgePolicy struct {
|
|||||||
// and ensure we're able to make upgrades to the network in a forwards
|
// and ensure we're able to make upgrades to the network in a forwards
|
||||||
// compatible manner.
|
// compatible manner.
|
||||||
ExtraOpaqueData []byte
|
ExtraOpaqueData []byte
|
||||||
|
|
||||||
db kvdb.Backend
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signature is a channel announcement signature, which is needed for proper
|
// Signature is a channel announcement signature, which is needed for proper
|
||||||
@@ -3823,11 +3821,6 @@ func (c *ChannelGraph) ChannelView() ([]EdgePoint, error) {
|
|||||||
return edgePoints, nil
|
return edgePoints, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewChannelEdgePolicy returns a new blank ChannelEdgePolicy.
|
|
||||||
func (c *ChannelGraph) NewChannelEdgePolicy() *ChannelEdgePolicy {
|
|
||||||
return &ChannelEdgePolicy{db: c.db}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarkEdgeZombie attempts to mark a channel identified by its channel ID as a
|
// MarkEdgeZombie attempts to mark a channel identified by its channel ID as a
|
||||||
// zombie. This method is used on an ad-hoc basis, when channels need to be
|
// zombie. This method is used on an ad-hoc basis, when channels need to be
|
||||||
// marked as zombies outside the normal pruning cycle.
|
// marked as zombies outside the normal pruning cycle.
|
||||||
@@ -4624,12 +4617,6 @@ func fetchChanEdgePolicies(edgeIndex kvdb.RBucket, edges kvdb.RBucket,
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// As we may have a single direction of the edge but not the other,
|
|
||||||
// only fill in the database pointers if the edge is found.
|
|
||||||
if edge1 != nil {
|
|
||||||
edge1.db = db
|
|
||||||
}
|
|
||||||
|
|
||||||
// Similarly, the second node is contained within the latter
|
// Similarly, the second node is contained within the latter
|
||||||
// half of the edge information.
|
// half of the edge information.
|
||||||
node2Pub := edgeInfo[33:66]
|
node2Pub := edgeInfo[33:66]
|
||||||
@@ -4638,10 +4625,6 @@ func fetchChanEdgePolicies(edgeIndex kvdb.RBucket, edges kvdb.RBucket,
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if edge2 != nil {
|
|
||||||
edge2.db = db
|
|
||||||
}
|
|
||||||
|
|
||||||
return edge1, edge2, nil
|
return edge1, edge2, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -671,7 +671,6 @@ func createChannelEdge(db kvdb.Backend, node1, node2 *LightningNode) (*ChannelEd
|
|||||||
FeeProportionalMillionths: 3452352,
|
FeeProportionalMillionths: 3452352,
|
||||||
Node: secondNode,
|
Node: secondNode,
|
||||||
ExtraOpaqueData: []byte("new unknown feature2"),
|
ExtraOpaqueData: []byte("new unknown feature2"),
|
||||||
db: db,
|
|
||||||
}
|
}
|
||||||
edge2 := &ChannelEdgePolicy{
|
edge2 := &ChannelEdgePolicy{
|
||||||
SigBytes: testSig.Serialize(),
|
SigBytes: testSig.Serialize(),
|
||||||
@@ -686,7 +685,6 @@ func createChannelEdge(db kvdb.Backend, node1, node2 *LightningNode) (*ChannelEd
|
|||||||
FeeProportionalMillionths: 90392423,
|
FeeProportionalMillionths: 90392423,
|
||||||
Node: firstNode,
|
Node: firstNode,
|
||||||
ExtraOpaqueData: []byte("new unknown feature1"),
|
ExtraOpaqueData: []byte("new unknown feature1"),
|
||||||
db: db,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return edgeInfo, edge1, edge2
|
return edgeInfo, edge1, edge2
|
||||||
@@ -992,7 +990,6 @@ func newEdgePolicy(chanID uint64, db kvdb.Backend,
|
|||||||
MaxHTLC: lnwire.MilliSatoshi(prand.Int63()),
|
MaxHTLC: lnwire.MilliSatoshi(prand.Int63()),
|
||||||
FeeBaseMSat: lnwire.MilliSatoshi(prand.Int63()),
|
FeeBaseMSat: lnwire.MilliSatoshi(prand.Int63()),
|
||||||
FeeProportionalMillionths: lnwire.MilliSatoshi(prand.Int63()),
|
FeeProportionalMillionths: lnwire.MilliSatoshi(prand.Int63()),
|
||||||
db: db,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3202,10 +3199,6 @@ func compareEdgePolicies(a, b *ChannelEdgePolicy) error {
|
|||||||
if err := compareNodes(a.Node, b.Node); err != nil {
|
if err := compareNodes(a.Node, b.Node); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(a.db, b.db) {
|
|
||||||
return fmt.Errorf("db doesn't match: expected %#v, \n "+
|
|
||||||
"got %#v", a.db, b.db)
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user