autopilot/multi: replace PubKey -> NodeKey on directive

This commit is contained in:
Conner Fromknecht 2018-09-04 01:55:05 -07:00
parent e702a6a266
commit d5f97f7bdc
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7
4 changed files with 13 additions and 13 deletions

@ -321,7 +321,7 @@ func TestAgentChannelFailureSignal(t *testing.T) {
// request attachment directives, return a fake so the agent will // request attachment directives, return a fake so the agent will
// attempt to open a channel. // attempt to open a channel.
var fakeDirective = AttachmentDirective{ var fakeDirective = AttachmentDirective{
PeerKey: self, NodeKey: self,
NodeID: NewNodeID(self), NodeID: NewNodeID(self),
ChanAmt: btcutil.SatoshiPerBitcoin, ChanAmt: btcutil.SatoshiPerBitcoin,
Addrs: []net.Addr{ Addrs: []net.Addr{
@ -659,7 +659,7 @@ func TestAgentImmediateAttach(t *testing.T) {
} }
nodeID := NewNodeID(pub) nodeID := NewNodeID(pub)
directives[i] = AttachmentDirective{ directives[i] = AttachmentDirective{
PeerKey: pub, NodeKey: pub,
NodeID: nodeID, NodeID: nodeID,
ChanAmt: btcutil.SatoshiPerBitcoin, ChanAmt: btcutil.SatoshiPerBitcoin,
Addrs: []net.Addr{ Addrs: []net.Addr{
@ -790,7 +790,7 @@ func TestAgentPrivateChannels(t *testing.T) {
t.Fatalf("unable to generate key: %v", err) t.Fatalf("unable to generate key: %v", err)
} }
directives[i] = AttachmentDirective{ directives[i] = AttachmentDirective{
PeerKey: pub, NodeKey: pub,
NodeID: NewNodeID(pub), NodeID: NewNodeID(pub),
ChanAmt: btcutil.SatoshiPerBitcoin, ChanAmt: btcutil.SatoshiPerBitcoin,
Addrs: []net.Addr{ Addrs: []net.Addr{
@ -911,7 +911,7 @@ func TestAgentPendingChannelState(t *testing.T) {
} }
nodeID := NewNodeID(nodeKey) nodeID := NewNodeID(nodeKey)
nodeDirective := AttachmentDirective{ nodeDirective := AttachmentDirective{
PeerKey: nodeKey, NodeKey: nodeKey,
NodeID: nodeID, NodeID: nodeID,
ChanAmt: 0.5 * btcutil.SatoshiPerBitcoin, ChanAmt: 0.5 * btcutil.SatoshiPerBitcoin,
Addrs: []net.Addr{ Addrs: []net.Addr{
@ -1273,7 +1273,7 @@ func TestAgentSkipPendingConns(t *testing.T) {
t.Fatalf("unable to generate key: %v", err) t.Fatalf("unable to generate key: %v", err)
} }
nodeDirective := AttachmentDirective{ nodeDirective := AttachmentDirective{
PeerKey: nodeKey, NodeKey: nodeKey,
NodeID: NewNodeID(nodeKey), NodeID: NewNodeID(nodeKey),
ChanAmt: 0.5 * btcutil.SatoshiPerBitcoin, ChanAmt: 0.5 * btcutil.SatoshiPerBitcoin,
Addrs: []net.Addr{ Addrs: []net.Addr{

@ -85,10 +85,10 @@ type ChannelGraph interface {
// AttachmentHeuristic. It details to which node a channel should be created // AttachmentHeuristic. It details to which node a channel should be created
// to, and also the parameters which should be used in the channel creation. // to, and also the parameters which should be used in the channel creation.
type AttachmentDirective struct { type AttachmentDirective struct {
// PeerKey is the target node for this attachment directive. It can be // NodeKey is the target node for this attachment directive. It can be
// identified by its public key, and therefore can be used along with // identified by its public key, and therefore can be used along with
// a ChannelOpener implementation to execute the directive. // a ChannelOpener implementation to execute the directive.
PeerKey *btcec.PublicKey NodeKey *btcec.PublicKey
// NodeID is the serialized compressed pubkey of the target node. // NodeID is the serialized compressed pubkey of the target node.
NodeID NodeID NodeID NodeID

@ -245,7 +245,7 @@ func (p *ConstrainedPrefAttachment) Select(self *btcec.PublicKey, g ChannelGraph
} }
directives = append(directives, AttachmentDirective{ directives = append(directives, AttachmentDirective{
// TODO(roasbeef): need curve? // TODO(roasbeef): need curve?
PeerKey: &btcec.PublicKey{ NodeKey: &btcec.PublicKey{
X: pub.X, X: pub.X,
Y: pub.Y, Y: pub.Y,
}, },

@ -349,11 +349,11 @@ func TestConstrainedPrefAttachmentSelectTwoVertexes(t *testing.T) {
edge2Pub := edge2.Peer.PubKey() edge2Pub := edge2.Peer.PubKey()
switch { switch {
case bytes.Equal(directive.PeerKey.SerializeCompressed(), edge1Pub[:]): case bytes.Equal(directive.NodeKey.SerializeCompressed(), edge1Pub[:]):
case bytes.Equal(directive.PeerKey.SerializeCompressed(), edge2Pub[:]): case bytes.Equal(directive.NodeKey.SerializeCompressed(), edge2Pub[:]):
default: default:
t1.Fatalf("attached to unknown node: %x", t1.Fatalf("attached to unknown node: %x",
directive.PeerKey.SerializeCompressed()) directive.NodeKey.SerializeCompressed())
} }
// As the number of funds available exceed the // As the number of funds available exceed the
@ -634,8 +634,8 @@ func TestConstrainedPrefAttachmentSelectSkipNodes(t *testing.T) {
// We'll simulate a channel update by adding the nodes // We'll simulate a channel update by adding the nodes
// we just establish channel with the to set of nodes // we just establish channel with the to set of nodes
// to be skipped. // to be skipped.
skipNodes[NewNodeID(directives[0].PeerKey)] = struct{}{} skipNodes[NewNodeID(directives[0].NodeKey)] = struct{}{}
skipNodes[NewNodeID(directives[1].PeerKey)] = struct{}{} skipNodes[NewNodeID(directives[1].NodeKey)] = struct{}{}
// If we attempt to make a call to the Select function, // If we attempt to make a call to the Select function,
// without providing any new information, then we // without providing any new information, then we