Browse Source

fix encode_msg: optional fields were not sent

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
ThomasV 6 years ago
parent
commit
0f00f4f655
  1. 8
      electrum/lnmsg.py

8
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)
@ -123,10 +125,6 @@ class LNSerializer:
leng = _eval_exp_with_ctx(poslenMap["length"], clone)
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)

Loading…
Cancel
Save