move lnadr from main to lndc package

This commit is contained in:
Tadge Dryja
2016-01-17 10:45:07 -08:00
parent ba0f86d4dc
commit 9e5f302288
4 changed files with 102 additions and 94 deletions

View File

@@ -110,7 +110,7 @@ out:
// connectPeerMsg...
type connectPeerMsg struct {
addr *lnAddr
addr *lndc.LNAdr
reply chan error
}
@@ -143,10 +143,10 @@ out:
// either need a compressed pubkey, or a
// 20-byte pkh.
var remoteId []byte
if addr.pubKey == nil {
remoteId = addr.bitcoinAddr.ScriptAddress()
if addr.PubKey == nil {
remoteId = addr.Base58Addr.ScriptAddress()
} else {
remoteId = addr.pubKey.SerializeCompressed()
remoteId = addr.PubKey.SerializeCompressed()
}
// Attempt to connect to the remote
@@ -154,7 +154,7 @@ out:
// connection, or the crypto negotation
// breaks down, then return an error to the
// caller.
ipAddr := addr.netAddr.String()
ipAddr := addr.NetAddr.String()
conn := lndc.NewConn(s.longTermPriv, nil)
if err := conn.Dial(ipAddr, remoteId); err != nil {
msg.reply <- err
@@ -178,7 +178,7 @@ out:
}
// ConnectToPeer...
func (s *server) ConnectToPeer(addr *lnAddr) error {
func (s *server) ConnectToPeer(addr *lndc.LNAdr) error {
reply := make(chan error, 1)
s.queries <- &connectPeerMsg{addr, reply}