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:
1 file changed
+2
-2
+2
-2
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user