diff --git a/contrib/pyln-proto/pyln/proto/wire.py b/contrib/pyln-proto/pyln/proto/wire.py index 9b7ea62cd..f306938c5 100644 --- a/contrib/pyln-proto/pyln/proto/wire.py +++ b/contrib/pyln-proto/pyln/proto/wire.py @@ -267,8 +267,9 @@ class LightningConnection(object): raise ValueError("Unsupported handshake version {}, only version " "0 is supported.".format(v)) rs = decryptWithAD(self.temp_k2, self.nonce(1), h.digest(), c) + self.remote_pubkey = PublicKey(rs) h.update(c) - se = ecdh(self.handshake['e'], PublicKey(rs)) + se = ecdh(self.handshake['e'], self.remote_pubkey) self.chaining_key, self.temp_k3 = hkdf_two_keys( se.raw, self.chaining_key