Browse Source

ln: save htlc signatures

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
Janus 7 years ago
committed by ThomasV
parent
commit
a841fa3602
  1. 5
      electrum/lnbase.py
  2. 2
      electrum/lnhtlc.py
  3. 2
      electrum/lnutil.py
  4. 1
      electrum/tests/test_lnhtlc.py

5
electrum/lnbase.py

@ -611,6 +611,7 @@ class Peer(PrintError):
funding_locked_received = False,
was_announced = False,
current_commitment_signature = None,
current_htlc_signatures = None,
feerate=local_feerate
),
"constraints": ChannelConstraints(capacity=funding_sat, is_initiator=True, funding_txn_minimum_depth=funding_txn_minimum_depth)
@ -1020,7 +1021,9 @@ class Peer(PrintError):
self.print_error("commitment_signed", payload)
channel_id = payload['channel_id']
chan = self.channels[channel_id]
chan.local_state=chan.local_state._replace(current_commitment_signature=payload['signature'])
chan.local_state=chan.local_state._replace(
current_commitment_signature=payload['signature'],
current_htlc_signatures=payload['htlc_signature'])
self.lnworker.save_channel(chan)
self.commitment_signed[channel_id].put_nowait(payload)

2
electrum/lnhtlc.py

@ -56,7 +56,7 @@ is_key = lambda k: k.endswith("_basepoint") or k.endswith("_key")
def maybeDecode(k, v):
assert type(v) is not list
if k in ["node_id", "channel_id", "short_channel_id", "pubkey", "privkey", "current_per_commitment_point", "next_per_commitment_point", "per_commitment_secret_seed", "current_commitment_signature"] and v is not None:
if k in ["node_id", "channel_id", "short_channel_id", "pubkey", "privkey", "current_per_commitment_point", "next_per_commitment_point", "per_commitment_secret_seed", "current_commitment_signature", "current_htlc_signatures"] and v is not None:
return binascii.unhexlify(v)
return v

2
electrum/lnutil.py

@ -18,7 +18,7 @@ ChannelConfig = namedtuple("ChannelConfig", [
"to_self_delay", "dust_limit_sat", "max_htlc_value_in_flight_msat", "max_accepted_htlcs"])
OnlyPubkeyKeypair = namedtuple("OnlyPubkeyKeypair", ["pubkey"])
RemoteState = namedtuple("RemoteState", ["ctn", "next_per_commitment_point", "amount_msat", "revocation_store", "current_per_commitment_point", "next_htlc_id", "feerate"])
LocalState = namedtuple("LocalState", ["ctn", "per_commitment_secret_seed", "amount_msat", "next_htlc_id", "funding_locked_received", "was_announced", "current_commitment_signature", "feerate"])
LocalState = namedtuple("LocalState", ["ctn", "per_commitment_secret_seed", "amount_msat", "next_htlc_id", "funding_locked_received", "was_announced", "current_commitment_signature", "current_htlc_signatures", "feerate"])
ChannelConstraints = namedtuple("ChannelConstraints", ["capacity", "is_initiator", "funding_txn_minimum_depth"])
#OpenChannel = namedtuple("OpenChannel", ["channel_id", "short_channel_id", "funding_outpoint", "local_config", "remote_config", "remote_state", "local_state", "constraints", "node_id"])

1
electrum/tests/test_lnhtlc.py

@ -60,6 +60,7 @@ def create_channel_state(funding_txid, funding_index, funding_sat, local_feerate
funding_locked_received=True,
was_announced=False,
current_commitment_signature=None,
current_htlc_signatures=None,
feerate=local_feerate
),
"constraints":lnbase.ChannelConstraints(capacity=funding_sat, is_initiator=is_initiator, funding_txn_minimum_depth=3),

Loading…
Cancel
Save