2019-06-26 08:39:34 +02:00
|
|
|
package routing
|
|
|
|
|
|
|
|
import (
|
2019-08-05 11:38:09 +02:00
|
|
|
"fmt"
|
|
|
|
|
2019-06-26 08:39:34 +02:00
|
|
|
"github.com/lightningnetwork/lnd/routing/route"
|
|
|
|
)
|
|
|
|
|
|
|
|
// DirectedNodePair stores a directed pair of nodes.
|
|
|
|
type DirectedNodePair struct {
|
|
|
|
From, To route.Vertex
|
|
|
|
}
|
2019-08-05 11:38:09 +02:00
|
|
|
|
|
|
|
// NewDirectedNodePair instantiates a new DirectedNodePair struct.
|
|
|
|
func NewDirectedNodePair(from, to route.Vertex) DirectedNodePair {
|
|
|
|
return DirectedNodePair{
|
|
|
|
From: from,
|
|
|
|
To: to,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// String converts a node pair to its human readable representation.
|
|
|
|
func (d DirectedNodePair) String() string {
|
|
|
|
return fmt.Sprintf("%v -> %v", d.From, d.To)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reverse returns a reversed copy of the pair.
|
|
|
|
func (d DirectedNodePair) Reverse() DirectedNodePair {
|
|
|
|
return DirectedNodePair{From: d.To, To: d.From}
|
|
|
|
}
|