Skip to content

Commit

Permalink
simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
ecdsa committed May 13, 2024
1 parent f8e687c commit 6abf2c9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions electrum/lnchannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1895,6 +1895,10 @@ def _filter_peerbackup(self, state, owner, is_client: bool) -> dict:
d[k].pop('ctn_local' if owner == REMOTE else 'ctn_remote')

state.pop('local_config' if owner == REMOTE else 'remote_config')
# revocation store is not part of local
if owner == LOCAL:
state.pop('revocation_store')

return state

def remove_timestamps(self, state) -> dict:
Expand All @@ -1911,9 +1915,7 @@ def get_our_signed_peerbackup(self, owner) -> dict:
"""client method"""
state = self.get_our_peerbackup()
state = self._filter_peerbackup(state, owner, True)
if owner == LOCAL:
state.pop('revocation_store')
else:
if owner == REMOTE:
state['remote_config']['encrypted_seed'] = None
return state

Expand All @@ -1924,8 +1926,6 @@ def get_their_signed_peerbackup(self, owner) -> dict:
if owner == REMOTE:
state['remote_config']['encrypted_seed'] = None
state['revocation_store'] = self.get_their_revocation_store()
else:
state.pop('revocation_store')
return state

@classmethod
Expand Down Expand Up @@ -2072,8 +2072,6 @@ def verify_peerbackup(self, owner, peerbackup_bytes, signature):
# filter the state
state = self._filter_peerbackup(state, owner, True)
state = self.remove_timestamps(state)
if owner == LOCAL:
state.pop('revocation_store')
peerbackup_bytes = self.encode_peerbackup(state)
sighash = sha256d(peerbackup_bytes)
key = 'our_local_state_hash' if owner == LOCAL else 'our_remote_state_hash'
Expand Down

0 comments on commit 6abf2c9

Please sign in to comment.