URI: 
       tfix encode_msg: optional fields were not sent - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 0f00f4f6554d2afc503b63b9510e9c864fc23111
   DIR parent 67f1ade7984e28ce6106c1db4ac803a424f6e8a4
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Sat,  8 Jun 2019 15:14:23 +0200
       
       fix encode_msg: optional fields were not sent
       
       Diffstat:
         M electrum/lnmsg.py                   |       8 +++-----
       
       1 file changed, 3 insertions(+), 5 deletions(-)
       ---
   DIR diff --git a/electrum/lnmsg.py b/electrum/lnmsg.py
       t@@ -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)
       t@@ -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')