multi: remove dead code
This commit is contained in:
71 files changed
+35
-766
No files matched your search
@@ -437,7 +437,6 @@ func (b *BtcdFilteredChainView) chainFilterer() {
|
||||
type filterUpdate struct {
|
||||
newUtxos []wire.OutPoint
|
||||
updateHeight uint32
|
||||
done chan struct{}
|
||||
}
|
||||
|
||||
// UpdateFilter updates the UTXO filter which is to be consulted when creating
|
||||
|
||||
@@ -3,7 +3,6 @@ package routing
|
||||
import (
|
||||
"container/heap"
|
||||
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/routing/route"
|
||||
)
|
||||
@@ -120,62 +119,3 @@ func (d *distanceHeap) PushOrFix(dist nodeWithDist) {
|
||||
// Call heap.Fix to reorder the heap.
|
||||
heap.Fix(d, index)
|
||||
}
|
||||
|
||||
// path represents an ordered set of edges which forms an available path from a
|
||||
// given source node to our destination. During the process of computing the
|
||||
// KSP's from a source to destination, several path swill be considered in the
|
||||
// process.
|
||||
type path struct {
|
||||
// dist is the distance from the source node to the destination node
|
||||
// that the path requires.
|
||||
dist int
|
||||
|
||||
// hops is an ordered list of edges that comprises a potential payment
|
||||
// path.
|
||||
hops []*channeldb.ChannelEdgePolicy
|
||||
}
|
||||
|
||||
// pathHeap is a min-heap that stores potential paths to be considered within
|
||||
// our KSP implementation. The heap sorts paths according to their cumulative
|
||||
// distance from a given source.
|
||||
type pathHeap struct {
|
||||
paths []path
|
||||
}
|
||||
|
||||
// Len returns the number of nodes in the priority queue.
|
||||
//
|
||||
// NOTE: This is part of the heap.Interface implementation.
|
||||
func (p *pathHeap) Len() int { return len(p.paths) }
|
||||
|
||||
// Less returns whether the item in the priority queue with index i should sort
|
||||
// before the item with index j.
|
||||
//
|
||||
// NOTE: This is part of the heap.Interface implementation.
|
||||
func (p *pathHeap) Less(i, j int) bool {
|
||||
return p.paths[i].dist < p.paths[j].dist
|
||||
}
|
||||
|
||||
// Swap swaps the nodes at the passed indices in the priority queue.
|
||||
//
|
||||
// NOTE: This is part of the heap.Interface implementation.
|
||||
func (p *pathHeap) Swap(i, j int) {
|
||||
p.paths[i], p.paths[j] = p.paths[j], p.paths[i]
|
||||
}
|
||||
|
||||
// Push pushes the passed item onto the priority queue.
|
||||
//
|
||||
// NOTE: This is part of the heap.Interface implementation.
|
||||
func (p *pathHeap) Push(x interface{}) {
|
||||
p.paths = append(p.paths, x.(path))
|
||||
}
|
||||
|
||||
// Pop removes the highest priority item (according to Less) from the priority
|
||||
// queue and returns it.
|
||||
//
|
||||
// NOTE: This is part of the heap.Interface implementation.
|
||||
func (p *pathHeap) Pop() interface{} {
|
||||
n := len(p.paths)
|
||||
x := p.paths[n-1]
|
||||
p.paths = p.paths[0 : n-1]
|
||||
return x
|
||||
}
|
||||
@@ -125,7 +125,6 @@ type mockChain struct {
|
||||
utxos map[wire.OutPoint]wire.TxOut
|
||||
|
||||
bestHeight int32
|
||||
bestHash *chainhash.Hash
|
||||
|
||||
sync.RWMutex
|
||||
}
|
||||
|
||||
@@ -75,22 +75,6 @@ func computeFee(amt lnwire.MilliSatoshi,
|
||||
return edge.FeeBaseMSat + (amt*edge.FeeProportionalMillionths)/1000000
|
||||
}
|
||||
|
||||
// isSamePath returns true if path1 and path2 travel through the exact same
|
||||
// edges, and false otherwise.
|
||||
func isSamePath(path1, path2 []*channeldb.ChannelEdgePolicy) bool {
|
||||
if len(path1) != len(path2) {
|
||||
return false
|
||||
}
|
||||
|
||||
for i := 0; i < len(path1); i++ {
|
||||
if path1[i].ChannelID != path2[i].ChannelID {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// newRoute returns a fully valid route between the source and target that's
|
||||
// capable of supporting a payment of `amtToSend` after fees are fully
|
||||
// computed. If the route is too long, or the selected path cannot support the
|
||||
|
||||
@@ -324,21 +324,6 @@ type testChannelEnd struct {
|
||||
*testChannelPolicy
|
||||
}
|
||||
|
||||
func defaultTestChannelEnd(alias string, capacity btcutil.Amount) *testChannelEnd {
|
||||
return &testChannelEnd{
|
||||
Alias: alias,
|
||||
testChannelPolicy: &testChannelPolicy{
|
||||
Expiry: 144,
|
||||
MinHTLC: lnwire.MilliSatoshi(1000),
|
||||
MaxHTLC: lnwire.NewMSatFromSatoshis(capacity),
|
||||
FeeBaseMsat: lnwire.MilliSatoshi(1000),
|
||||
FeeRate: lnwire.MilliSatoshi(1),
|
||||
LastUpdate: testTime,
|
||||
Disabled: false,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func symmetricTestChannel(alias1 string, alias2 string, capacity btcutil.Amount,
|
||||
policy *testChannelPolicy, chanID ...uint64) *testChannel {
|
||||
|
||||
@@ -1675,13 +1660,6 @@ func TestPathFindSpecExample(t *testing.T) {
|
||||
}
|
||||
defer cleanUp()
|
||||
|
||||
const (
|
||||
aliceFinalCLTV = 10
|
||||
bobFinalCLTV = 20
|
||||
carolFinalCLTV = 30
|
||||
daveFinalCLTV = 40
|
||||
)
|
||||
|
||||
// We'll first exercise the scenario of a direct payment from Bob to
|
||||
// Carol, so we set "B" as the source node so path finding starts from
|
||||
// Bob.
|
||||
|
||||
@@ -137,9 +137,3 @@ func (p *paymentSession) RequestRoute(payment *LightningPayment,
|
||||
|
||||
return route, err
|
||||
}
|
||||
|
||||
// nodeChannel is a combination of the node pubkey and one of its channels.
|
||||
type nodeChannel struct {
|
||||
node route.Vertex
|
||||
channel uint64
|
||||
}
|
||||
@@ -295,25 +295,6 @@ type Config struct {
|
||||
PathFindingConfig PathFindingConfig
|
||||
}
|
||||
|
||||
// routeTuple is an entry within the ChannelRouter's route cache. We cache
|
||||
// prospective routes based on first the destination, and then the target
|
||||
// amount. We required the target amount as that will influence the available
|
||||
// set of paths for a payment.
|
||||
type routeTuple struct {
|
||||
amt lnwire.MilliSatoshi
|
||||
dest [33]byte
|
||||
}
|
||||
|
||||
// newRouteTuple creates a new route tuple from the target and amount.
|
||||
func newRouteTuple(amt lnwire.MilliSatoshi, dest []byte) routeTuple {
|
||||
r := routeTuple{
|
||||
amt: amt,
|
||||
}
|
||||
copy(r.dest[:], dest)
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
// EdgeLocator is a struct used to identify a specific edge.
|
||||
type EdgeLocator struct {
|
||||
// ChannelID is the channel of this edge.
|
||||
@@ -325,31 +306,6 @@ type EdgeLocator struct {
|
||||
Direction uint8
|
||||
}
|
||||
|
||||
// newEdgeLocatorByPubkeys returns an edgeLocator based on its end point
|
||||
// pubkeys.
|
||||
func newEdgeLocatorByPubkeys(channelID uint64, fromNode, toNode *route.Vertex) *EdgeLocator {
|
||||
// Determine direction based on lexicographical ordering of both
|
||||
// pubkeys.
|
||||
var direction uint8
|
||||
if bytes.Compare(fromNode[:], toNode[:]) == 1 {
|
||||
direction = 1
|
||||
}
|
||||
|
||||
return &EdgeLocator{
|
||||
ChannelID: channelID,
|
||||
Direction: direction,
|
||||
}
|
||||
}
|
||||
|
||||
// newEdgeLocator extracts an edgeLocator based for a full edge policy
|
||||
// structure.
|
||||
func newEdgeLocator(edge *channeldb.ChannelEdgePolicy) *EdgeLocator {
|
||||
return &EdgeLocator{
|
||||
ChannelID: edge.ChannelID,
|
||||
Direction: uint8(edge.ChannelFlags & lnwire.ChanUpdateDirection),
|
||||
}
|
||||
}
|
||||
|
||||
// String returns a human readable version of the edgeLocator values.
|
||||
func (e *EdgeLocator) String() string {
|
||||
return fmt.Sprintf("%v:%v", e.ChannelID, e.Direction)
|
||||
|
||||
@@ -67,14 +67,6 @@ func (c *testCtx) RestartRouter() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func copyPubKey(pub *btcec.PublicKey) *btcec.PublicKey {
|
||||
return &btcec.PublicKey{
|
||||
Curve: btcec.S256(),
|
||||
X: pub.X,
|
||||
Y: pub.Y,
|
||||
}
|
||||
}
|
||||
|
||||
func createTestCtxFromGraphInstance(startingHeight uint32, graphInstance *testGraphInstance) (
|
||||
*testCtx, func(), error) {
|
||||
|
||||
|
||||
Reference in new issue
Block a user