From f1d5fdf323f55548abc3466426df3e944d221420 Mon Sep 17 00:00:00 2001 From: Sergi Delgado Segura Date: Fri, 11 Sep 2020 11:44:26 +0200 Subject: [PATCH] pyln: Sets remote_pubkey for LightningConnection if node is not the initiator Currently ``LightningConnection.remote_pubkey`` is set to ``None`` if the node is not the handshake initiator. This sets it to ``rs`` in act three from the receiver side --- contrib/pyln-proto/pyln/proto/wire.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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