Browse Source

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
pyln
Sergi Delgado Segura 4 years ago
committed by Rusty Russell
parent
commit
f1d5fdf323
  1. 3
      contrib/pyln-proto/pyln/proto/wire.py

3
contrib/pyln-proto/pyln/proto/wire.py

@ -267,8 +267,9 @@ class LightningConnection(object):
raise ValueError("Unsupported handshake version {}, only version " raise ValueError("Unsupported handshake version {}, only version "
"0 is supported.".format(v)) "0 is supported.".format(v))
rs = decryptWithAD(self.temp_k2, self.nonce(1), h.digest(), c) rs = decryptWithAD(self.temp_k2, self.nonce(1), h.digest(), c)
self.remote_pubkey = PublicKey(rs)
h.update(c) 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( self.chaining_key, self.temp_k3 = hkdf_two_keys(
se.raw, self.chaining_key se.raw, self.chaining_key

Loading…
Cancel
Save