mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-29 03:01:52 +01:00
channeldb: remove kvdb.Backend from ChannelEdgePolicy
This commit is contained in:
parent
f06f08f596
commit
9a62a46aa3
@ -3438,8 +3438,6 @@ type ChannelEdgePolicy struct {
|
||||
// and ensure we're able to make upgrades to the network in a forwards
|
||||
// compatible manner.
|
||||
ExtraOpaqueData []byte
|
||||
|
||||
db kvdb.Backend
|
||||
}
|
||||
|
||||
// Signature is a channel announcement signature, which is needed for proper
|
||||
@ -3823,11 +3821,6 @@ func (c *ChannelGraph) ChannelView() ([]EdgePoint, error) {
|
||||
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
|
||||
// zombie. This method is used on an ad-hoc basis, when channels need to be
|
||||
// marked as zombies outside the normal pruning cycle.
|
||||
@ -4624,12 +4617,6 @@ func fetchChanEdgePolicies(edgeIndex kvdb.RBucket, edges kvdb.RBucket,
|
||||
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
|
||||
// half of the edge information.
|
||||
node2Pub := edgeInfo[33:66]
|
||||
@ -4638,10 +4625,6 @@ func fetchChanEdgePolicies(edgeIndex kvdb.RBucket, edges kvdb.RBucket,
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
if edge2 != nil {
|
||||
edge2.db = db
|
||||
}
|
||||
|
||||
return edge1, edge2, nil
|
||||
}
|
||||
|
||||
|
@ -671,7 +671,6 @@ func createChannelEdge(db kvdb.Backend, node1, node2 *LightningNode) (*ChannelEd
|
||||
FeeProportionalMillionths: 3452352,
|
||||
Node: secondNode,
|
||||
ExtraOpaqueData: []byte("new unknown feature2"),
|
||||
db: db,
|
||||
}
|
||||
edge2 := &ChannelEdgePolicy{
|
||||
SigBytes: testSig.Serialize(),
|
||||
@ -686,7 +685,6 @@ func createChannelEdge(db kvdb.Backend, node1, node2 *LightningNode) (*ChannelEd
|
||||
FeeProportionalMillionths: 90392423,
|
||||
Node: firstNode,
|
||||
ExtraOpaqueData: []byte("new unknown feature1"),
|
||||
db: db,
|
||||
}
|
||||
|
||||
return edgeInfo, edge1, edge2
|
||||
@ -992,7 +990,6 @@ func newEdgePolicy(chanID uint64, db kvdb.Backend,
|
||||
MaxHTLC: lnwire.MilliSatoshi(prand.Int63()),
|
||||
FeeBaseMSat: 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 {
|
||||
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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user