electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 0f00f4f6554d2afc503b63b9510e9c864fc23111
parent 67f1ade7984e28ce6106c1db4ac803a424f6e8a4
Author: ThomasV <thomasv@electrum.org>
Date:   Sat,  8 Jun 2019 15:14:23 +0200

fix encode_msg: optional fields were not sent

Diffstat:
Melectrum/lnmsg.py | 8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/electrum/lnmsg.py b/electrum/lnmsg.py @@ -115,7 +115,9 @@ class LNSerializer: lengths = {} for k in typ["payload"]: poslenMap = typ["payload"][k] - if "feature" in poslenMap: continue + if k not in kwargs and "feature" in poslenMap: + continue + param = kwargs.get(k, 0) leng = _eval_exp_with_ctx(poslenMap["length"], lengths) try: clone = dict(lengths) @@ -124,10 +126,6 @@ class LNSerializer: except KeyError: pass try: - param = kwargs[k] - except KeyError: - param = 0 - try: if not isinstance(param, bytes): assert isinstance(param, int), "field {} is neither bytes or int".format(k) param = param.to_bytes(leng, 'big')