electrum

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

commit a841fa3602372726186cd1e50477e5924966249a
parent 9c442586b2680e260bec0267b4d5b42b1f3606d1
Author: Janus <ysangkok@gmail.com>
Date:   Wed, 25 Jul 2018 13:50:52 +0200

ln: save htlc signatures

Diffstat:
Melectrum/lnbase.py | 5++++-
Melectrum/lnhtlc.py | 2+-
Melectrum/lnutil.py | 2+-
Melectrum/tests/test_lnhtlc.py | 1+
4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/electrum/lnbase.py b/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) diff --git a/electrum/lnhtlc.py b/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 diff --git a/electrum/lnutil.py b/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"]) diff --git a/electrum/tests/test_lnhtlc.py b/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),