lndc: fix bug in pubkeyhash based authentication

The call to copy used incorrect slicing on `greetingMsg` which caused
the remote node to always reject the auth attempt as all zeroes
(0000..) was being sent as the local node’s guess to the remote node’s
public key identity.
This commit is contained in:
Olaoluwa Osuntokun 2016-06-20 21:48:24 -07:00
parent 7801c940df
commit 7b7d572984
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -92,7 +92,7 @@ func (c *LNDConn) Dial(
}
ourEphemeralPub := ourEphemeralPriv.PubKey()
// Sned 1. Send my ephemeral pubkey. Can add version bits.
// Send 1. Send my ephemeral pubkey. Can add version bits.
if _, err = writeClear(c.Conn, ourEphemeralPub.SerializeCompressed()); err != nil {
return err
}
@ -209,7 +209,7 @@ func (c *LNDConn) authPKH(
// Send 53 bytes: our pubkey, and the remote's pubkey hash.
var greetingMsg [53]byte
copy(greetingMsg[:33], myId.PubKey().SerializeCompressed())
copy(greetingMsg[:33], theirPKH)
copy(greetingMsg[33:], theirPKH)
if _, err := c.Conn.Write(greetingMsg[:]); err != nil {
return err
}